diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-12-17 11:24:44 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-12-17 11:24:44 -0500 |
commit | 982629bea416df976686467f235e09cb1a5531cc (patch) | |
tree | cf5147a81dca553986c01fd45bdd291375489197 /gcc/rust/backend/rust-compile-struct-field-expr.cc | |
parent | b1f91819e312d1e92d88a693718d791693cdf26c (diff) | |
download | gcc-982629bea416df976686467f235e09cb1a5531cc.zip gcc-982629bea416df976686467f235e09cb1a5531cc.tar.gz gcc-982629bea416df976686467f235e09cb1a5531cc.tar.bz2 |
c++: constantness of non-dependent NTTP argument [PR107437]
Here we're rejecting the use of the lambda capture of 't' (of empty
type) as a template argument ultimately because convert_nontype_argument
checks constantness using is_constant_expression, which returns false
for lambda captures since want_rval=false. But in this case I believe
an lvalue-to-rvalue conversion of the argument is implied, so we should
be using is_rvalue_constant_expression instead (which would return true
here).
However, it doesn't seem necessary to consider constantness at all
when deciding whether to instantiate a non-dependent argument in
convert_nontype_argument. So this patch gets rid of the problematic
constantness test altogether, which incidentally also fixes the similar
dg-ice'd testcase from PR87765. This is in line with a similar
change we made to finish_decltype_type in r12-7564-gec0f53a3a542e7.
PR c++/107437
PR c++/87765
gcc/cp/ChangeLog:
* pt.cc (convert_nontype_argument): Relax is_nondep_const_expr
test to !inst_dep_expr_p.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/lambda-generic-107437.C: New test.
* g++.dg/cpp1z/constexpr-lambda26.C: Remove dg-ice.
Diffstat (limited to 'gcc/rust/backend/rust-compile-struct-field-expr.cc')
0 files changed, 0 insertions, 0 deletions