https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101500
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9/10/11/12 Regression] gcc |[C++17] [DR2311] gcc
|accepts the code with extra |accepts the code with extra
|curly braces |curly braces
Status|NEW |SUSPENDED
URL| |wg21.link/cwg2311
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
This seems like an instance of issue 2311: with C++17 mandatory copy elision,
do we really want an actual call to the move constructor in this case? The
testcase is rejected in C++14 mode, as expected.
The standard says that we try to call a constructor, initializing the argument
with {A{}}. So we in turn look for an A constructor to initialize the
argument, initializing its argument from A{}. Under 2311, does this result in
still an rvalue? And the enclosing constructor call, still the same rvalue?
This seems parallel to
const A a = A(A(A()));
which is also accepted by clang in C++17 mode.
Perhaps we want to raise the priority of issue 2311.