Created
January 12, 2015 12:50
-
-
Save wancw/771bcb03826af0bd8ca6 to your computer and use it in GitHub Desktop.
Implicit conversion failure under Clang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class To{}; | |
#include <utility> | |
class From{ | |
public: | |
/* This will cause compilation error under Clang (3.5) with c++11 standard */ | |
operator const To() { return To(); } | |
/* Any one of below works fine */ | |
//explicit operator const To() { return To(); } | |
//operator To() { return To(); } | |
//operator To &&() { return std::move(To()); } | |
}; | |
int main() { | |
From f; | |
To t (f); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment