Помему GCC 4.9 в режиме C++ 14 всегда возвращает 1 когда мы пытаемся взять sizeof от VLA?
int foo(int i) {
int a[i];
return sizeof(a);
}
...
mov eax, 1
mov rsp, rcx
...
https://godbolt.org/g/RFdtou
Это было UB в С++ 14?
https://gcc.gnu.org/gcc-5/changes.html#cxx
"G++ no longer supports N3639 variable length arrays, as they were removed from the C++14 working paper prior to ratification. GNU VLAs are still supported, so VLA support is now the same in C++14 mode as in C++98 and C++11 modes."
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3639.html
Здравствуйте, placement_new, Вы писали:
Похоже на баг.
В 5.1 всё работает:
https://godbolt.org/g/b9KUrT
Здравствуйте, _NN_, Вы писали:
_NN>Здравствуйте, placement_new, Вы писали:
_NN>Похоже на баг.
_NN>В 5.1 всё работает:
_NN>https://godbolt.org/g/b9KUrT
Looks like a feature
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3639.html
The sizeof operator shall not be applied to ..., to an array of runtime bound, ...