Skip to content

Instantly share code, notes, and snippets.

@wancw
Created January 12, 2015 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wancw/771bcb03826af0bd8ca6 to your computer and use it in GitHub Desktop.
Save wancw/771bcb03826af0bd8ca6 to your computer and use it in GitHub Desktop.
Implicit conversion failure under Clang
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