[Bug c++/53753] stack based constructor is not called for Class1 Object1()

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sat Jun 23 09:59:00 GMT 2012


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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-23 09:58:58 UTC ---
I agree with Andrew, there is no object defined in the code, so the behaviour
is expected. 

Since you are using C++11 mode you can use a pair of braces here:

Myclass instance1{};

This will be a guaranteed variable definition and allows uniform initialization
even for built-in types.



More information about the Gcc-bugs mailing list