c++: __builtin_shufflevector with value-dep expr [PR105353]
authorMarek Polacek <polacek@redhat.com>
Fri, 22 Apr 2022 23:40:27 +0000 (19:40 -0400)
committerMarek Polacek <polacek@redhat.com>
Mon, 25 Apr 2022 15:15:51 +0000 (11:15 -0400)
commit1ba397e9f93d3abc93a6ecbabc3d873489a6fb7f
treee5bad1b6098fc5195d4ec9e3938a1d3c70f7a45c
parent235f88dbc3494c49e0f361a5a3f78491f72ff47c
c++: __builtin_shufflevector with value-dep expr [PR105353]

Here we issue an error from c_build_shufflevector while parsing a template
because it got a TEMPLATE_PARM_INDEX, but this function expects INTEGER_CSTs
(except the first two arguments).  It checks if any of the arguments are
type-dependent, if so, we leave the processing for later, but it should
also check value-dependency for the 3rd+ arguments, so as to avoid the
problem above.

This is not a regression -- __builtin_shufflevector was introduced in
GCC 12, but it looks safe enough.

PR c++/105353

gcc/cp/ChangeLog:

* typeck.cc (build_x_shufflevector): Use
instantiation_dependent_expression_p except for the first two
arguments.

gcc/testsuite/ChangeLog:

* g++.dg/ext/builtin-shufflevector-3.C: New test.
gcc/cp/typeck.cc
gcc/testsuite/g++.dg/ext/builtin-shufflevector-3.C [new file with mode: 0644]