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.
Jason