From b97c403176a5937575e7c5eea20026edfbe947f5 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 2 Dec 2010 20:02:29 +0000 Subject: [PATCH] Merge transparent union types using member's canonical param type git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120729 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 1bbe08e38d..42efcfbee7 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 = it->getType(); + QualType ET = getCanonicalParamType(it->getType()); 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 d13b4045a9..a825ed8a2e 100644 --- a/test/Sema/transparent-union.c +++ b/test/Sema/transparent-union.c @@ -2,6 +2,7 @@ typedef union { int *ip; float *fp; + long *__restrict rlp; } TU __attribute__((transparent_union)); void f(TU); // expected-note{{passing argument to parameter here}} @@ -26,6 +27,9 @@ void fip(int *i) {} void ffp(TU); void ffp(float *f) {} +void flp(TU); +void flp(long *l) {} + void fvp(TU); // expected-note{{previous declaration is here}} void fvp(void *p) {} // expected-error{{conflicting types}} -- 2.50.1