On 1/26/24 17:11, Jason Merrill wrote:
On 1/26/24 16:52, Jason Merrill wrote:
On 1/25/24 14:18, Patrick Palka wrote:
Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look
OK for trunk/13?  This isn't a very satisfactory fix, but at least
it safely fixes these testcases I guess.  Note that there's
implementation disagreement about the second testcase, GCC always
accepted it but Clang/MSVC/icc reject it.

Because of trying to initialize int& from {c}; removing the extra braces makes it work everywhore.

https://eel.is/c++draft/dcl.init#list-3.10 says that we always generate a prvalue in this case, so perhaps we shouldn't recalculate if the initializer is an init-list?

...but it seems bad to silently bind a const int& to a prvalue instead of directly to the reference returned by the operator, as clang does if we add const to the second testcase, so I think there's a defect in the standard here.

Perhaps bullet 3.9 should change to "...its referenced type is reference-related to E <ins>or scalar</ins>, ..."

Maybe for now also disable the maybe_valid heuristics in the case of an init-list?

The first testcase is special because it's a C-style cast; seems like the maybe_valid = false heuristics should be disabled if c_cast_p.

Jason


Reply via email to