[Bug c++/93314] Invalid use of non-static data member causes ICE in gimplify_expr

language.lawyer at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 17 19:26:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93314

--- Comment #1 from Language Lawyer <language.lawyer at gmail dot com> ---
GCC thinks that `char[S::m]` is VLA (because the lvalue-to-rvalue conversion on
`S::m` lvalue doesn't look like a constant expression) and tries to move the
evaluation of `sizeof(char[S::m])` to run time.

$ g++ prog.cc -pedantic

prog.cc: In function 'int main()':
prog.cc:4:28: warning: ISO C++ forbids variable length array [-Wvla]
    4 |     return sizeof(char[S::m]);
      |                            ^
prog.cc:4:27: internal compiler error: in gimplify_expr, at gimplify.c:14581
    4 |     return sizeof(char[S::m]);
      |
...


More information about the Gcc-bugs mailing list