[Bug c++/60009] g++ allows copy-initialization of an array of class type from a non-braced string literal
rs2740 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 25 04:21:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60009
TC <rs2740 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rs2740 at gmail dot com
--- Comment #1 from TC <rs2740 at gmail dot com> ---
http://stackoverflow.com/questions/24378882/weird-gcc-array-initialization-behavior
appears to be related.
Minimal example:
struct A { A() { } };
int main() { A a[10] = A(); }
Compiles with GCC 4.6, 4.7, 4.8 and 4.9, in both C++98 and C++11 modes, even
though it shouldn't. However,
struct A { };
int main() { A a[10] = A(); }
does not compile in any of the GCC versions tested.
struct A { A() = default; };
int main() { A a[10] = A(); }
Compiles with GCC 4.9 in C++11 mode; does not compile with 4.6-4.8 in C++ 11
mode, however.
More information about the Gcc-bugs
mailing list