Add a test case for -ffreestanding that redefines malloc.
Warn that complex numbers are an extension in a freestanding C99
implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64568 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index e898782..00bfb13 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -170,8 +170,11 @@
}
// Handle complex types.
- if (DS.getTypeSpecComplex() == DeclSpec::TSC_complex)
+ if (DS.getTypeSpecComplex() == DeclSpec::TSC_complex) {
+ if (getLangOptions().Freestanding)
+ Diag(DS.getTypeSpecComplexLoc(), diag::ext_freestanding_complex);
Result = Context.getComplexType(Result);
+ }
assert(DS.getTypeSpecComplex() != DeclSpec::TSC_imaginary &&
"FIXME: imaginary types not supported yet!");