From: Daniel Dunbar Date: Wed, 28 Jan 2009 21:22:12 +0000 (+0000) Subject: Handle complex types in ASTContext::mergeTypes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64cfdb7da3cb744642fe8a99ad5c851ad3c930b2;p=clang Handle complex types in ASTContext::mergeTypes git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63238 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 5e22691059..c43ae78c9f 100644 --- a/lib/AST/ASTContext.cpp +++ b/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/test/Sema/merge-decls.c b/test/Sema/merge-decls.c index 0d3cce36bd..468f3f6142 100644 --- a/test/Sema/merge-decls.c +++ b/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'}}