On 09/29/2017 01:12 PM, Stefan Ram wrote:
> Joseph Hesse <
jo...@gmail.com> writes:
>> I am surprised that the following compiles with g++.
>> void f(int x)
>> {
>> int a[x];
>> }
>
> This might be a compiler-specific extension.
>
> Maybe you would like to try:
>
> -std=c++14 -pedantic -pedantic-errors
It compiles OK with -std=C++98 for all versions of gcc for x86-64 over
4.4.7; the -pedantic flag gives the warning "ISO C++ forbids variable
length arrays." Clang 3.0 and above for x86-64 it also compiles but
warns "variable length arrays are a C99 feature, accepted as extension"
with -std=C++98 -pedantic; with -std=C++14 -pedantic for clang 3.5 and
above it just reports "variable length arrays are a C99 feature"