This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Jan 2018 09:59:48 +0000
- Subject: [Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor
- Auto-submitted: auto-generated
- References: <bug-83937-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
struct S
{
S(int i = 42); // (1)
};
void f()
{
S( {} ); // (2)
}
So if I understand this right, (2) is a copy-list-initialization which is
supposed to initialize the constructor's parameter in (1), i.e. an integer to
0, as if we wrote int i = {} (copy-list-initialization), not the type S. But
the latter is what's happening in C++17 and that is wrong.