[Bug c++/57724] wrong error: returning a value from a constructor

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 26 11:49:00 GMT 2013


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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm inclined to say this is a Clang bug too.

[stmt.return]/3 "A return statement with an expression of type void can be used
only in functions with a return type of cv void;" and constructors do not have
any return type, not even void.

[class.ctor]/8 "A return statement in the body of a constructor shall not
specify a return value."  That doesn't really help, because a return statement
with an expression of type void does not return a value.



More information about the Gcc-bugs mailing list