On 4/5/19 4:50 PM, Marek Polacek wrote:
On Fri, Apr 05, 2019 at 12:12:11AM -0400, Jason Merrill wrote:
On 4/4/19 5:18 PM, Marek Polacek wrote:
On Thu, Mar 28, 2019 at 03:54:30PM -0400, Jason Merrill wrote:
On 3/20/19 4:12 PM, Marek Polacek wrote:
The fix for 77656 caused us to call convert_nontype_argument even for
value-dependent arguments, to perform the conversion in order to avoid
a bogus warning.

In this case, the argument is Pod{N}.  The call to build_converted_constant_expr
in convert_nontype_argument produces Pod::operator Enum(&{N}).  It doesn't crash
because we're in a template and build_address no longer crashes on CONSTRUCTORs
in a template.

Yeah, we shouldn't be preserving lower level codes like this ADDR_EXPR; we
should probably return an IMPLICIT_CONV_EXPR rather than make the call
explicit.

I'm having trouble with this.  Do we want build_converted_constant_expr_internal
to build an IMPLICIT_CONV_EXPR in a template, much like
perform_implicit_conversion?  That seems to break a lot of stuff, and I'm
nervous about that at this stage :/  We could probably handle this specially
in convert_nontype_argument.  Maybe build an IMPLICIT_CONV_EXPR for
value-dependent CONSTRUCTORs?

That sounds reasonable.

Great, thanks.  Something like this, then?

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2019-04-05  Marek Polacek  <pola...@redhat.com>

        PR c++/87145 - bogus error converting class type in template arg list.
        * pt.c (convert_nontype_argument): Don't call
        build_converted_constant_expr if it could involve calling a conversion
        function with a instantiation-dependent constructor as its argument.

OK.

Jason

Reply via email to