]> granicus.if.org Git - clang/commitdiff
Merge transparent union types using member's unqualified type
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 2 Dec 2010 21:00:06 +0000 (21:00 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 2 Dec 2010 21:00:06 +0000 (21:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120736 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/Sema/transparent-union.c

index 42efcfbee7037b37152b659931ca3432e1b3db84..6c2a77ae6935b9803c6385f8dd81a1f33d695423 100644 (file)
@@ -4736,7 +4736,7 @@ QualType ASTContext::mergeTransparentUnionType(QualType T, QualType SubType,
     if (UD->hasAttr<TransparentUnionAttr>()) {
       for (RecordDecl::field_iterator it = UD->field_begin(),
            itend = UD->field_end(); it != itend; ++it) {
-        QualType ET = getCanonicalParamType(it->getType());
+        QualType ET = it->getType().getUnqualifiedType();
         QualType MT = mergeTypes(ET, SubType, OfBlockPointer, Unqualified);
         if (!MT.isNull())
           return MT;
index a825ed8a2e4b4759b2a01b6653795e0a259ad807..ab1ba1867f47b00ad962c65d5cc3e67ef7ecd227 100644 (file)
@@ -3,6 +3,7 @@ typedef union {
   int *ip;
   float *fp;
   long *__restrict rlp;
+  void *vpa[1];
 } TU __attribute__((transparent_union));
 
 void f(TU); // expected-note{{passing argument to parameter here}}
@@ -39,6 +40,9 @@ void fsp(short *s) {} // expected-error{{conflicting types}}
 void fi(TU); // expected-note{{previous declaration is here}}
 void fi(int i) {} // expected-error{{conflicting types}}
 
+void fvpp(TU); // expected-note{{previous declaration is here}}
+void fvpp(void **v) {} // expected-error{{conflicting types}}
+
 /* FIXME: we'd like to just use an "int" here and align it differently
    from the normal "int", but if we do so we lose the alignment
    information from the typedef within the compiler. */