]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix cast to pointer to VLA.
authorJason Merrill <jason@redhat.com>
Mon, 2 Mar 2020 19:42:47 +0000 (14:42 -0500)
committerJason Merrill <jason@redhat.com>
Mon, 2 Mar 2020 20:49:58 +0000 (15:49 -0500)
commitf137a7c6b122e524294fb792bb97d5f3b0600c4f
tree48c4f5cb4c5aa47c1ce982761ff64337b001a2ea
parent9d5df8e3221c5fe5c8aca0334655b075bd9ea556
c++: Fix cast to pointer to VLA.

The C front-end fixed this issue in r257620 by adding a DECL_EXPR from
grokdeclarator.  We don't have an easy way to do that in the C++ front-end,
but it works fine to create and prepend a DECL_EXPR when we are genericizing
the NOP_EXPR for the cast.

The C patch wraps the DECL_EXPR in a BIND_EXPR, but that seems unnecessary
in C++; this is just a hook to run gimplify_type_sizes, we aren't actually
declaring anything that we need to worry about scoping for.

gcc/cp/ChangeLog
2020-03-02  Jason Merrill  <jason@redhat.com>

PR c++/88256
* cp-gimplify.c (predeclare_vla): New.
(cp_genericize_r) [NOP_EXPR]: Call it.
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/c-c++-common/pr84305.c [moved from gcc/testsuite/gcc.c-torture/compile/pr84305.c with 78% similarity]