Diagnose VLAs as an error in C++.
Also, treat the GNU __null as an integral constant expression to match
GCC's behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81490 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index c4064e1..9f95198 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -593,9 +593,11 @@
if (ArraySize && !ArraySize->isTypeDependent() &&
!ArraySize->isValueDependent() &&
!ArraySize->isIntegerConstantExpr(Context))
- Diag(Loc, diag::ext_vla);
+ Diag(Loc, getLangOptions().CPlusPlus? diag::err_vla_cxx : diag::ext_vla);
else if (ASM != ArrayType::Normal || Quals != 0)
- Diag(Loc, diag::ext_c99_array_usage);
+ Diag(Loc,
+ getLangOptions().CPlusPlus? diag::err_c99_array_usage_cxx
+ : diag::ext_c99_array_usage);
}
return T;