diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-08-20 08:34:36 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-08-20 08:34:36 -0400 |
commit | 5348e3cb9bc99d2ee4d7438b8eca5c92fff5b931 (patch) | |
tree | fb41f19ae76754c19116845f1f770419ee283fdb /libcpp | |
parent | 20a5b4824993ae1c99f3b965c5e07bbd2c64b2ce (diff) | |
download | gcc-5348e3cb9bc99d2ee4d7438b8eca5c92fff5b931.zip gcc-5348e3cb9bc99d2ee4d7438b8eca5c92fff5b931.tar.gz gcc-5348e3cb9bc99d2ee4d7438b8eca5c92fff5b931.tar.bz2 |
c++: default targ eligibility refinement [PR101463]
On Tue, 9 Jan 2024, Jason Merrill wrote:
> On 1/5/24 15:01, Patrick Palka wrote[1]:
> > Here during default template argument substitution we wrongly consider
> > the (substituted) default arguments v and vt<int> as value-dependent[1]
> > which ultimately leads to deduction failure for the calls.
> >
> > The bogus value_dependent_expression_p result aside, I noticed
> > type_unification_real during default targ substitution keeps track of
> > whether all previous targs are known and non-dependent, as is the case
> > for these calls. And in such cases it should be safe to avoid checking
> > dependence of the substituted default targ and just assume it's not.
> > This patch implements this optimization, which lets us accept both
> > testcases by sidestepping the value_dependent_expression_p issue
> > altogether.
>
> Hmm, maybe instead of substituting and asking if it's dependent, we should
> specifically look for undeduced parameters.
This patch implements this refinement, which incidentally fixes PR101463
just as well.
[1]: https://gcc.gnu.org/pipermail/gcc-patches/2024-January/641957.html
PR c++/101463
gcc/cp/ChangeLog:
* pt.cc (type_unification_real): Directly look for undeduced
parameters in the default argument instead of doing a trial
substitution.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/nontype6.C: New test.
* g++.dg/cpp1z/nontype6a.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions