mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 19:29:37 +00:00
Merge pull request #2288 from acqn/TypeFix
[cc65] Fixed an iteration bug in type composition
This commit is contained in:
commit
92f869cdfb
@ -4102,9 +4102,10 @@ static void hieQuest (ExprDesc* Expr)
|
|||||||
/* Avoid further errors */
|
/* Avoid further errors */
|
||||||
ResultType = NewPointerTo (type_void);
|
ResultType = NewPointerTo (type_void);
|
||||||
} else {
|
} else {
|
||||||
/* Result has the composite type */
|
/* Result has the properly qualified composite type */
|
||||||
ResultType = TypeDup (Expr2.Type);
|
ResultType = TypeDup (Expr2.Type);
|
||||||
TypeComposition (ResultType, Expr3.Type);
|
TypeComposition (ResultType, Expr3.Type);
|
||||||
|
ResultType[1].C |= GetQualifier (Indirect (Expr3.Type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (IsClassPtr (Expr2.Type) && Expr3IsNULL) {
|
} else if (IsClassPtr (Expr2.Type) && Expr3IsNULL) {
|
||||||
|
@ -485,13 +485,6 @@ void TypeComposition (Type* lhs, const Type* rhs)
|
|||||||
} else if (RightCount != UNSPECIFIED) {
|
} else if (RightCount != UNSPECIFIED) {
|
||||||
SetElementCount (lhs, RightCount);
|
SetElementCount (lhs, RightCount);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* Combine the qualifiers */
|
|
||||||
if (IsClassPtr (lhs)) {
|
|
||||||
++lhs;
|
|
||||||
++rhs;
|
|
||||||
lhs->C |= GetQualifier (rhs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next type string element */
|
/* Next type string element */
|
||||||
|
5
test/err/bug2285-composite-type.c
Normal file
5
test/err/bug2285-composite-type.c
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/* Bug #2285 - Regression in type composition */
|
||||||
|
|
||||||
|
void foo(); /* OK */
|
||||||
|
void foo(int (*)(int)); /* OK */
|
||||||
|
void foo(int (*)(long)); /* WRONG: Should be an error */
|
Loading…
Reference in New Issue
Block a user