From: David Chisnall Date: Mon, 11 Jan 2010 22:33:19 +0000 (+0000) Subject: Allow VLAs in C++ if in GNU mode (GNU C++ permits them). Clang can now compile Langu... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=004f81f8d1ec38047dba4d198311d31ccc8dd94d;p=clang Allow VLAs in C++ if in GNU mode (GNU C++ permits them). Clang can now compile LanguageKit, although the resulting code crashes (although not in any of the functions that use VLAs). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93198 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 2bddf9ecd6..0f9bd516b4 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -651,8 +651,10 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, } T = Context.getConstantArrayType(T, ConstVal, ASM, Quals); } - // If this is not C99, extwarn about VLA's and C99 array size modifiers. - if (!getLangOptions().C99) { + // If this is not C99 or C++ with GNU extenisons, extwarn about VLA's and C99 + // array size modifiers. + if (!getLangOptions().C99 && + !(getLangOptions().CPlusPlus && getLangOptions().GNUMode)) { if (ArraySize && !ArraySize->isTypeDependent() && !ArraySize->isValueDependent() && !ArraySize->isIntegerConstantExpr(Context))