You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[C23] Fix treating unnamed records nested in different types as compatible. (llvm#162933)
Don't compare and accept unnamed records from different types only
because they are defined in `RecordDecl` `DeclContext`. During recursive
comparison don't reject unnamed records defined inside other ordered
containers like Objective-C classes.
rdar://161592007
typedefstruct { intx; } untagged_q_t; // both-error {{typedef redefinition with different types}}
38
51
voidfunc3(void) {
39
52
structS { intx; }; // c17-note {{previous definition is here}}
40
53
structT { structSs; }; // c17-note {{previous definition is here}}
@@ -389,13 +402,40 @@ void nontag_both_in_params(struct { int i; } Arg1, struct { int i; } Arg2) {
389
402
_Static_assert(0== _Generic(__typeof__(Arg1), __typeof__(Arg2) : 1, default : 0)); // both-warning {{passing a type argument as the first operand to '_Generic' is a C2y extension}}
inner_unnamed_tagged.untagged=matchingType.untagged; // both-error-re {{assigning to 'struct (unnamed struct at {{.*}})' from incompatible type 'struct (unnamed struct at {{.*}})'}}
436
+
inner_unnamed_tagged.untagged=differentFieldName.untaggedDifferent; // both-error-re {{assigning to 'struct (unnamed struct at {{.*}})' from incompatible type 'struct (unnamed struct at {{.*}})'}}
437
+
inner_unnamed_tagged.untagged=differentType.untagged; // both-error-re {{assigning to 'struct (unnamed struct at {{.*}})' from incompatible type 'struct (unnamed struct at {{.*}})'}}
438
+
}
399
439
400
440
// Test the same thing with enumerations (test for unions is omitted because
401
441
// unions and structures are both RecordDecl objects, whereas EnumDecl is not).
0 commit comments