Re: [C++] [PR84231] overload on cond_expr in template

2018-03-05 Thread Alexandre Oliva
On Mar 2, 2018, Jason Merrill wrote: > Let's add a comment along the lines of > /* Let lvalue_kind know this was a glvalue. */ > OK with that change. Thanks, here's what I'm about to check in. [C++] [PR84231] overload on cond_expr in template A non-type-dependent COND_EXPR within a templat

Re: [C++] [PR84231] overload on cond_expr in template

2018-03-02 Thread Jason Merrill
On Fri, Mar 2, 2018 at 2:57 AM, Alexandre Oliva wrote: > On Feb 28, 2018, Jason Merrill wrote: > >> On Wed, Feb 28, 2018 at 12:24 AM, Alexandre Oliva wrote: >>> + if (processing_template_decl) >>> +result_type = cp_build_reference_type (result_type, !is_lvalue); > >> If !is_lvalue, we don't

Re: [C++] [PR84231] overload on cond_expr in template

2018-03-01 Thread Alexandre Oliva
On Feb 28, 2018, Jason Merrill wrote: > On Wed, Feb 28, 2018 at 12:24 AM, Alexandre Oliva wrote: >> + if (processing_template_decl) >> +result_type = cp_build_reference_type (result_type, !is_lvalue); > If !is_lvalue, we don't want a reference type at all, as the result is > a prvalue. is

Re: [C++] [PR84231] overload on cond_expr in template

2018-02-28 Thread Jason Merrill
On Wed, Feb 28, 2018 at 12:24 AM, Alexandre Oliva wrote: > + if (processing_template_decl) > +result_type = cp_build_reference_type (result_type, !is_lvalue); If !is_lvalue, we don't want a reference type at all, as the result is a prvalue. is_lvalue should probably rename to is_glvalue. T

Re: [C++] [PR84231] overload on cond_expr in template

2018-02-27 Thread Alexandre Oliva
On Feb 27, 2018, Jason Merrill wrote: > Perhaps it would be easier to add the REFERENCE_TYPE in > build_conditional_expr_1, adjusting result_type based on > processing_template_decl and is_lvalue. It is, indeed! Here's the patch, regstrapped on i686- and x86_64-linux-gnu. The only unexpected g

Re: [C++] [PR84231] overload on cond_expr in template

2018-02-27 Thread Jason Merrill
On Tue, Feb 27, 2018 at 1:05 PM, Alexandre Oliva wrote: > On Feb 15, 2018, Jason Merrill wrote: > >> On Thu, Feb 8, 2018 at 9:09 PM, Alexandre Oliva wrote: >>> + /* If it was supposed to be an rvalue but it's not, adjust >>> +one of the operands so that any overload resolutio

Re: [C++] [PR84231] overload on cond_expr in template

2018-02-27 Thread Alexandre Oliva
On Feb 15, 2018, Jason Merrill wrote: > On Thu, Feb 8, 2018 at 9:09 PM, Alexandre Oliva wrote: >> + /* If it was supposed to be an rvalue but it's not, adjust >> +one of the operands so that any overload resolution >> +taking this COND_EXPR as an operand makes the

Re: [C++] [PR84231] overload on cond_expr in template

2018-02-15 Thread Jason Merrill
On Thu, Feb 8, 2018 at 9:09 PM, Alexandre Oliva wrote: > + /* If it was supposed to be an rvalue but it's not, adjust > +one of the operands so that any overload resolution > +taking this COND_EXPR as an operand makes the correct > +decisions. See c++/8