Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

[C++11] Explicitly defaulted private constructor is not private

$
0
0

I am developing the Singleton pattern implementation using C++11 features (default, delete keywords).

Just first Google request take me to such implementation: https://stackoverflow.com/questions/21231925/singleton-in-c-11-using-member-function-specifiers

Under Visual C++ it also compiles. But should not!

When i add empty body to the singleton constructor (instead of "default"), the code correctly fails to compile.

Is this issue a compiler bug, or author (and i) are doing something wrong?

P.S. My config: Visual Studio 2013 for Windows Desktop, Update 2; Windows 8


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>