]> granicus.if.org Git - clang/commitdiff
Teach Type::isIntegerType() about GCC's __complex__ integer extensions...
authorSteve Naroff <snaroff@apple.com>
Mon, 14 Jan 2008 21:38:57 +0000 (21:38 +0000)
committerSteve Naroff <snaroff@apple.com>
Mon, 14 Jan 2008 21:38:57 +0000 (21:38 +0000)
Bug submitted by Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45976 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Type.cpp
test/Sema/complex-int.c [new file with mode: 0644]

index 610cd8fcabcaf2cc63a67b4b706a5cd222663306..949b6f8d2a33310d2957ae4cb4f7b4ec4c3ae27d 100644 (file)
@@ -310,6 +310,9 @@ bool Type::isIntegerType() const {
   if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
     if (TT->getDecl()->getKind() == Decl::Enum)
       return true;
+  // Check for GCC complex integer extension.
+  if (const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
+    return CT->getElementType()->isIntegerType();
   if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
     return VT->getElementType()->isIntegerType();
   return false;
diff --git a/test/Sema/complex-int.c b/test/Sema/complex-int.c
new file mode 100644 (file)
index 0000000..f0c29a9
--- /dev/null
@@ -0,0 +1,10 @@
+// RUN: clang %s -verify -fsyntax-only
+
+void a() {
+__complex__ int arr;
+__complex__ short brr;
+__complex__ int result;
+
+result = arr*brr;
+}
+