diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-10-05 15:35:21 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-10-05 15:35:21 -0400 |
commit | d4c470c376b4cb82c9a0b7e8a4b88c44d5e4289d (patch) | |
tree | 3732ff7652e2120e50d373161c847f0970ac8b11 /gcc/cp/constexpr.c | |
parent | ec0124e0acb556cdf5dba0e8d0ca6b69d9537fcc (diff) | |
download | gcc-d4c470c376b4cb82c9a0b7e8a4b88c44d5e4289d.zip gcc-d4c470c376b4cb82c9a0b7e8a4b88c44d5e4289d.tar.gz gcc-d4c470c376b4cb82c9a0b7e8a4b88c44d5e4289d.tar.bz2 |
c++: unifying equal NONTYPE_ARGUMENT_PACKs [PR102547]
Here during partial ordering of the two partial specializations we end
up in unify with parm=arg=NONTYPE_ARGUMENT_PACK<V0, V1>, and crash shortly
thereafter because uses_template_parms(parms) calls potential_const_expr
which doesn't handle NONTYPE_ARGUMENT_PACK.
This patch fixes this by extending potential_constant_expression to handle
NONTYPE_ARGUMENT_PACK appropriately.
PR c++/102547
gcc/cp/ChangeLog:
* constexpr.c (potential_constant_expression_1): Handle
NONTYPE_ARGUMENT_PACK.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/variadic-partial2.C: New test.
* g++.dg/cpp0x/variadic-partial2a.C: New test.
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r-- | gcc/cp/constexpr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 18d9d11..e95ff00 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -9043,6 +9043,16 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, case CO_RETURN_EXPR: return false; + case NONTYPE_ARGUMENT_PACK: + { + tree args = ARGUMENT_PACK_ARGS (t); + int len = TREE_VEC_LENGTH (args); + for (int i = 0; i < len; ++i) + if (!RECUR (TREE_VEC_ELT (args, i), any)) + return false; + return true; + } + default: if (objc_non_constant_expr_p (t)) return false; |