summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-01-28 21:22:12 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-01-28 21:22:12 +0000
commit804c0441c2b71bd5a80aa121f39ddc5b1b1cbcee (patch)
tree7679defbdf533d87ced76b251f690cf68b8264e6 /clang
parentf675864e3c00b5601f17d8f11d723b12200a1535 (diff)
downloadbcm5719-llvm-804c0441c2b71bd5a80aa121f39ddc5b1b1cbcee.tar.gz
bcm5719-llvm-804c0441c2b71bd5a80aa121f39ddc5b1b1cbcee.zip
Handle complex types in ASTContext::mergeTypes
llvm-svn: 63238
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ASTContext.cpp3
-rw-r--r--clang/test/Sema/merge-decls.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 5e226910599..c43ae78c9f5 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2615,6 +2615,9 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS) {
case Type::Builtin:
// Only exactly equal builtin types are compatible, which is tested above.
return QualType();
+ case Type::Complex:
+ // Distinct complex types are incompatible.
+ return QualType();
case Type::Vector:
if (areCompatVectorTypes(LHS->getAsVectorType(), RHS->getAsVectorType()))
return LHS;
diff --git a/clang/test/Sema/merge-decls.c b/clang/test/Sema/merge-decls.c
index 0d3cce36bdc..468f3f61428 100644
--- a/clang/test/Sema/merge-decls.c
+++ b/clang/test/Sema/merge-decls.c
@@ -20,3 +20,12 @@ int funcdef2() { return 0; } // expected-error {{redefinition of 'funcdef2'}}
// PR2502
void (*f)(void);
void (*f)() = 0;
+
+typedef __attribute__(( ext_vector_type(2) )) int Vi2;
+typedef __attribute__(( ext_vector_type(2) )) float Vf2;
+
+Vf2 g0; // expected-note {{previous definition is here}}
+Vi2 g0; // expected-error {{redefinition of 'g0'}}
+
+_Complex int g1; // expected-note {{previous definition is here}}
+_Complex float g1; // expected-error {{redefinition of 'g1'}}
OpenPOWER on IntegriCloud