]> granicus.if.org Git - clang/commitdiff
Handle complex types in ASTContext::mergeTypes
authorDaniel Dunbar <daniel@zuster.org>
Wed, 28 Jan 2009 21:22:12 +0000 (21:22 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 28 Jan 2009 21:22:12 +0000 (21:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63238 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/Sema/merge-decls.c

index 5e2269105992b9d0f9e4a02ee98f2fa383a0d9a1..c43ae78c9f587df6a051434d32871ee6933c9738 100644 (file)
@@ -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;
index 0d3cce36bdc5d7448a7922e3c7902f315821c4af..468f3f61428f1623a699d92649995e82cc003e7e 100644 (file)
@@ -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'}}