Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jason Merrill
On Thu, Mar 15, 2018 at 7:33 PM, Jakub Jelinek wrote: > On Thu, Mar 15, 2018 at 04:50:57PM -0400, Jason Merrill wrote: >> > +/* Don't elide the initialization of TARGET_EXPR_SLOT for this >> > TARGET_EXPR. */ >> > +#define TARGET_EXPR_NO_ELIDE(NODE) (TARGET_EXPR_CHECK >> >

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jakub Jelinek
On Thu, Mar 15, 2018 at 03:33:12PM -0400, Jason Merrill wrote: > Folding away the INDIRECT_REF is fine. It's the TARGET_EXPR handling > that is wrong. Ah, ok. > > types of TARGET_EXPR, or ask some langhook whether it is ok to do so > > (say not ok if find_placeholders (t))? Or

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jakub Jelinek
On Thu, Mar 15, 2018 at 04:50:57PM -0400, Jason Merrill wrote: > > +/* Don't elide the initialization of TARGET_EXPR_SLOT for this > > TARGET_EXPR. */ > > +#define TARGET_EXPR_NO_ELIDE(NODE) (TARGET_EXPR_CHECK > > (NODE)->base.private_flag) > > This should be specifically on the rhs of a

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jason Merrill
On Thu, Mar 15, 2018 at 4:28 PM, Jakub Jelinek wrote: > On Thu, Mar 15, 2018 at 03:33:12PM -0400, Jason Merrill wrote: >> Folding away the INDIRECT_REF is fine. It's the TARGET_EXPR handling >> that is wrong. > > Ah, ok. > >> > types of TARGET_EXPR, or ask some langhook whether

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jakub Jelinek
On Thu, Mar 15, 2018 at 01:15:53PM -0400, Jason Merrill wrote: > > g++.dg/cpp0x/nsdmi13.C ICEs without that, we have there: > > a = A({}); > > and build_over_call does: > > 8163 else if (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE > > (as_base))) > > 8164{ > > 8165

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jason Merrill
On Thu, Mar 15, 2018 at 1:59 PM, Jakub Jelinek wrote: > On Thu, Mar 15, 2018 at 01:15:53PM -0400, Jason Merrill wrote: >> > g++.dg/cpp0x/nsdmi13.C ICEs without that, we have there: >> > a = A({}); >> > and build_over_call does: >> > 8163 else if (tree_int_cst_equal

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jason Merrill
On Thu, Mar 15, 2018 at 4:32 AM, Jakub Jelinek wrote: > On Wed, Mar 14, 2018 at 08:55:47PM -0400, Jason Merrill wrote: >> > @@ -3192,16 +3198,70 @@ replace_placeholders (tree exp, tree obj >> > return exp; >> > >> >tree *tp = >> > - hash_set pset; >> > -

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-15 Thread Jakub Jelinek
On Wed, Mar 14, 2018 at 08:55:47PM -0400, Jason Merrill wrote: > > @@ -3192,16 +3198,70 @@ replace_placeholders (tree exp, tree obj > > return exp; > > > >tree *tp = > > - hash_set pset; > > - replace_placeholders_t data = { obj, false, }; > > + /* Use exp instead of *(type *) */ >

Re: [C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-14 Thread Jason Merrill
On Wed, Mar 14, 2018 at 6:33 PM, Jakub Jelinek wrote: > The following patch is an attempt to fix PLACEHOLDER_EXPR handling. > As e.g. > struct Y > { > static Y bar (Y y) { return y; } > int i; > int n = bar (Y{2,i}).m + bar {Y{2,i,i}).n; > int m = i; > }; > is rejected -

[C++ PATCH] Fix PLACEHOLDER_EXPR handling (PR c++/79937, PR c++/82410)

2018-03-14 Thread Jakub Jelinek
Hi! The following patch is an attempt to fix PLACEHOLDER_EXPR handling. As e.g. struct Y { static Y bar (Y y) { return y; } int i; int n = bar (Y{2,i}).m + bar {Y{2,i,i}).n; int m = i; }; is rejected - one can't use incomplete ctors which would need NSDMIs until the class is defined, I