Help identify the conversion bug in MSVC

Hi, I found a bug in MSVC 10.0 that causes a bug in Boost.Optional. I will be trying to find a workaround for the compiler. I would like to ask people with the access to MSVC 11.0 and 12.0 to check if the bug also persist in these newer releases. The following code is expected to compile: struct A { A(int) {} A(A &&) {} }; struct B { operator A() { return A(1); } operator int() { return 0; } }; int main() { A t = B(); } The following code is expected *NOT *to compile: struct A { A(int) {} }; struct B { operator int() { return 0; } }; int main() { A t = B(); } Please let me know what your compiler says. Thanks, &rzej

Andrzej Krzemienski
I would like to ask people with the access to MSVC 11.0 and 12.0 to check if the bug also persist in these newer releases.
The following code is expected to compile: [...] The following code is expected *NOT *to compile: [...] Please let me know what your compiler says.
Both issues persist in MSVC 12 Update 3 as well as MSVC 14 CTP 3. The error message for the code expected to compile is: error C2440: 'initializing' : cannot convert from 'B' to 'A' No constructor could take the source type, or constructor overload resolution was ambiguous

2014-09-08 11:11 GMT+02:00 Marcel Raad
Andrzej Krzemienski
writes: I would like to ask people with the access to MSVC 11.0 and 12.0 to check if the bug also persist in these newer releases.
The following code is expected to compile: [...] The following code is expected *NOT *to compile: [...] Please let me know what your compiler says.
Both issues persist in MSVC 12 Update 3 as well as MSVC 14 CTP 3.
The error message for the code expected to compile is: error C2440: 'initializing' : cannot convert from 'B' to 'A' No constructor could take the source type, or constructor overload resolution was ambiguous
Thanks. &rzej
participants (2)
-
Andrzej Krzemienski
-
Marcel Raad