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++/60417] [DR 1518] Bogus error on C++03 aggregate initialization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60417

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Still a regression for aggregate-initialization of arrays:

struct A { explicit A(int = 0); };

int main()
{
  A a[1] = { };
}

zzz.cc: In function âint main()â:
zzz.cc:5:14: error: converting to âAâ from initializer list would use explicit
constructor âA::A(int)â
   A a[1] = { };
              ^

And similarly for array members that are list-initialized:

struct A { explicit A(int = 0); };
struct B { A a[1]; B() : a{} {} };

int main()
{
  B b;
}

zz.cc: In constructor âB::B()â:
zz.cc:2:28: error: converting to âAâ from initializer list would use explicit
constructor âA::A(int)â
 struct B { A a[1]; B() : a{} {} };
                            ^

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