aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2010-12-02 20:02:29 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2010-12-02 20:02:29 +0000
commitb97c403176a5937575e7c5eea20026edfbe947f5 (patch)
tree15ec94943ea24eb6cedb6e5b05e8357891c37afc
parentc04d9d1be026cb201a716df1cd28a88878958bee (diff)
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
-rw-r--r--lib/AST/ASTContext.cpp2
-rw-r--r--test/Sema/transparent-union.c4
2 files changed, 5 insertions, 1 deletions
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<TransparentUnionAttr>()) {
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}}