From f91d7572ee7fa6f2926c8e7e816039a1154a59f8 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 2 Dec 2010 21:00:06 +0000 Subject: [PATCH] Merge transparent union types using member's unqualified type git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120736 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 2 +- test/Sema/transparent-union.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 42efcfbee7..6c2a77ae69 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -4736,7 +4736,7 @@ QualType ASTContext::mergeTransparentUnionType(QualType T, QualType SubType, if (UD->hasAttr()) { 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; diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c index a825ed8a2e..ab1ba1867f 100644 --- a/test/Sema/transparent-union.c +++ b/test/Sema/transparent-union.c @@ -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. */ -- 2.40.0