]> granicus.if.org Git - clang/commitdiff
Don't crash on _Imaginary.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 23 Sep 2010 09:40:31 +0000 (09:40 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 23 Sep 2010 09:40:31 +0000 (09:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114637 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaType.cpp
test/CodeGen/imaginary.c [new file with mode: 0644]

index 0927de34da4fff5458afff2dc4507006cb6c3325..a00dc0ec11d710ebe9d156308f700334d7876575 100644 (file)
@@ -2303,6 +2303,8 @@ def error_no_subobject_property_setting : Error<
 def ext_freestanding_complex : Extension<
   "complex numbers are an extension in a freestanding C99 implementation">;
 
+// FIXME: Remove when we support imaginary.
+def err_imaginary_not_supported : Error<"imaginary types are not supported">;
 
 // Obj-c expressions
 def warn_root_inst_method_not_found : Warning<
index aa30b5c2da302995c96a7a17dc8e9d8000069502..254eb7984dc4b8f67a3c33e8d587f03c6eeb6067 100644 (file)
@@ -392,8 +392,9 @@ static QualType ConvertDeclSpecToType(Sema &TheSema,
     Result = Context.getVectorType(Result, 128/typeSize, AltiVecSpec);
   }
 
-  assert(DS.getTypeSpecComplex() != DeclSpec::TSC_imaginary &&
-         "FIXME: imaginary types not supported yet!");
+  // FIXME: Imaginary.
+  if (DS.getTypeSpecComplex() == DeclSpec::TSC_imaginary)
+    TheSema.Diag(DS.getTypeSpecComplexLoc(), diag::err_imaginary_not_supported);
 
   // See if there are any attributes on the declspec that apply to the type (as
   // opposed to the decl).
diff --git a/test/CodeGen/imaginary.c b/test/CodeGen/imaginary.c
new file mode 100644 (file)
index 0000000..2649ceb
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -verify -emit-llvm-only %s
+
+// Just verify that we don't crash until we support _Imaginary.
+double _Imaginary foo; // expected-error {{imaginary types are not supported}}