Consider the following program:
#include
class A
{
public:
A( ) { std::cout << \"A()\\n\"; }
A( A& ) = delete;
A( int i ) { s
This is definitely a bug in Visual C++. According to standard:
12.3.2 Conversion functions [class.conv.fct]
2 - A conversion function may be explicit (7.1.2), in which case it is only considered as a user-defined conversion for direct-initialization (8.5) in certain contexts (13.3.1.4, 13.3.1.5, 13.3.1.6).
and there is no direct-initialization in your example.
Other C++ compilers such as GCC and Clang report an error in this case.
Brought up in the VS forum:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/af733e56-8045-4553-a9af-6555d02fc2f6/bug-in-vs-2013-support-for-explicit-conversion-operators?forum=visualstudiogeneral
And reported it as a bug:
http://connect.microsoft.com/VisualStudio/feedback/details/811334/bug-in-vs-2013-support-for-explicit-conversion-operators