diff options
author | Marek Polacek <polacek@redhat.com> | 2022-03-08 13:55:15 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-03-08 17:37:22 -0500 |
commit | d54ce4641ed106666208be36fd514cae8ff1153c (patch) | |
tree | 4e3142be3229f7bcdea6f56125fc7435cf6ac293 /gcc/cfgexpand.cc | |
parent | 2858e2afcb0a6553a222e724d8426451364ee755 (diff) | |
download | gcc-d54ce4641ed106666208be36fd514cae8ff1153c.zip gcc-d54ce4641ed106666208be36fd514cae8ff1153c.tar.gz gcc-d54ce4641ed106666208be36fd514cae8ff1153c.tar.bz2 |
c++: Wrong error with alias template in class tmpl [PR104108]
In r10-6329 I tried to optimize the number of calls to v_d_e_p in
convert_nontype_argument by remembering whether the expression was
value-dependent in a bool flag. I did that wrongly assuming that its
value-dependence will not be changed by build_converted_constant_expr.
This testcase shows that it can: b_c_c_e gets a VAR_DECL for m_parameter,
which is not value-dependent, but we're converting it to "const int &"
so it returns
(const int &)(const int *) &m_parameter
which suddenly becomes value-dependent because of the added ADDR_EXPR:
has_value_dependent_address is now true because m_parameter's context S<T>
is dependent. With this bug in place, we went to the second branch here:
if (TYPE_REF_OBJ_P (TREE_TYPE (expr)) && val_dep_p)
/* OK, dependent reference. We don't want to ask whether a DECL is
itself value-dependent, since what we want here is its address. */;
else
{
expr = build_address (expr);
if (invalid_tparm_referent_p (type, expr, complain))
return NULL_TREE;
}
wherein build_address created a bad tree and then i_t_r_p complained.
PR c++/104108
gcc/cp/ChangeLog:
* pt.cc (convert_nontype_argument): Recompute
value_dependent_expression_p after build_converted_constant_expr.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-74.C: New test.
Diffstat (limited to 'gcc/cfgexpand.cc')
0 files changed, 0 insertions, 0 deletions