You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suddenly I got puzzled what happens if class B with an implicit conversion to A is passed as an argument to parameter type A with an implicit constructor from const B&. I was surprised! https://godbolt.org/z/EabPGnY4z
gcc compiles and calls the constructor of A(const B&) and ignores the conversion o_0
msvc gives a strange error that an "operator could not be called" 🫤
llvm detects and reports a conversion ambiguity with the two candidates listed💪💪
Length
This should be bite-sized (5-10 minutes) episode
The text was updated successfully, but these errors were encountered:
Rules about what conversion chains are considered (or not) in C++ are indeed not always crystal clear. An educational presentation would be appreciated... (along with best-practices).
Channel
This is a "C++Weekly" episode request.
Topics
Suddenly I got puzzled what happens if class B with an implicit conversion to A is passed as an argument to parameter type A with an implicit constructor from const B&. I was surprised! https://godbolt.org/z/EabPGnY4z
Length
This should be bite-sized (5-10 minutes) episode
The text was updated successfully, but these errors were encountered: