https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81952
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot
gnu.org
Status|NEW |ASSIGNED
CC| |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed by
commit 2170d4b6ddca526b53e87215dbf6fab5973000c7
Author: Jason Merrill <[email protected]>
Date: Wed Mar 21 23:53:19 2018 -0400
PR c++/81311 - wrong C++17 overload resolution.
* call.c (build_user_type_conversion_1): Remove C++17 code.
(conv_binds_ref_to_prvalue): New.
(build_over_call): Handle C++17 copy elision.
(build_special_member_call): Only do C++17 copy elision here if the
argument is already the right type.
From-SVN: r258755
Adjusted test:
template <class T>
struct opt {
opt() { }
opt(opt const& ) { __builtin_abort (); }
opt(opt&& ) { __builtin_abort (); }
template <class U>
opt(U&& ) { }
};
struct foo
{
explicit operator opt<int>() { __builtin_abort (); return {}; }
};
int main()
{
opt<int> o(foo{});
}