This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]