will
will

Reputation: 13

How do you make clang++ not warn about variable length arrays?

I am compiling with clang++ -pedantic -Werror -std=c++11 C++11 does not support variable length arrays and so the compiler warns when they are used. g++ supports the -Wno-vla option to stop it from doing this. This doesn't appear to work in clang++, is there an alternative that does work?

Upvotes: 1

Views: 1101

Answers (1)

Mat
Mat

Reputation: 206861

error: variable length arrays are a C99 feature [-Werror,-Wvla-extension]
  int a[argc];
       ^
1 error generated.

clang++ helpfully tells you what flags generated the diagnostic. Just "invert" the flag, in this case: -Wno-vla-extension.

Upvotes: 1

Related Questions