• Advertisement
Sign in to follow this  

'void' Preceding constructor

This topic is 2676 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When the Ctor of a class is preceded by a 'void' specifier then it isn't called but seems to be compiled just as some new valid function.

Example:


class CTest
{
// Invalid Ctor definition, does not cause error
// and won't be called when creating an instance of the class!
void CTest()
{
Trace("Ctor Call!\r\n");
}
}



Could that be a candidate for a compiler improvement? I think a C++ compiler will generate an error in this case.

Regards,
Thomas

Share this post


Link to post
Share on other sites
Advertisement
Sorry for this one, you are right:
I am using 2.19.0 in my latest official release build. In my development version which uses 2.19.2 the compiler correctly raises an error message.

Regards

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement