Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-08 Thread Jason Merrill via Gcc-patches
ns. Maybe we want to check is_copy_initialization in cp_finish_decl? That seems to work nicely :) All xfailed tests for the static data member initialization case now also pass. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Subject: [PATCH] c++: detecting cop

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-08 Thread Patrick Palka via Gcc-patches
; > > > > well. And I suppose we might as well use it in do_class_deduction > > > > > > too, > > > > > > since doing so lets us remove the flags parameter. > > > > > > > > > > Before removing the flags parameter ple

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-08 Thread Jason Merrill via Gcc-patches
nicely :) All xfailed tests for the static data member initialization case now also pass. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Subject: [PATCH] c++: detecting copy-init context during CTAD [PR102137] Here we're failing to communicate to cp_fi

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-08 Thread Patrick Palka via Gcc-patches
> I added to do_class_deduction: > > > >gcc_assert (bool(flags & LOOKUP_ONLYCONVERTING) == is_copy_initialization > > (init)); > > > > Turns out removing the flags parameter breaks CTAD for new-expressions > > of the form 'new TT(x)' becau

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-08 Thread Jason Merrill via Gcc-patches
finish_decl from tsubst_expr: -- >8 -- Subject: [PATCH] c++: detecting copy-init context during CTAD [PR102137] Here we're failing to communicate to cp_finish_decl from tsubst_expr that we're in a copy-initialization context (via the LOOKUP_ONLYCONVERTING flag), which causes us to always

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-08 Thread Patrick Palka via Gcc-patches
is case build_new passes just 'x' as the initializer to do_auto_deduction (as opposed to a single TREE_LIST), for which is_copy_initialization returns true even though it's really direct initalization. Also turns out we're similarly not passing the right LOOKUP_* flags to cp_

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-07 Thread Jason Merrill via Gcc-patches
nce doing so lets us remove the flags parameter. Before removing the flags parameter please try asserting that it now matches is_copy_initialization and see if anything breaks. -- >8 -- Subject: [PATCH] c++: detecting copy-init context during CTAD [PR102137] Here we're failing to c

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-07 Thread Patrick Palka via Gcc-patches
sense. Moving that code from build_aggr_init to cp_finish_decl broke things, but using it in both spots seems to work well. And I suppose we might as well use it in do_class_deduction too, since doing so lets us remove the flags parameter. -- >8 -- Subject: [PATCH] c++: detect

Re: [PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-04 Thread Jason Merrill via Gcc-patches
On 3/4/22 14:24, Patrick Palka wrote: Here we're failing to communicate to cp_finish_decl from tsubst_expr that we're in a copy-initialization context (via the LOOKUP_ONLYCONVERTING flag), which causes do_class_deduction to always consider explicit deduction guides when performing CTAD for a temp

[PATCH] c++: detecting copy-init context during CTAD [PR102137]

2022-03-04 Thread Patrick Palka via Gcc-patches
Here we're failing to communicate to cp_finish_decl from tsubst_expr that we're in a copy-initialization context (via the LOOKUP_ONLYCONVERTING flag), which causes do_class_deduction to always consider explicit deduction guides when performing CTAD for a templated variable initializer. We could fi