Created
February 7, 2012 13:37
-
-
Save eiennohito/1759702 to your computer and use it in GitHub Desktop.
C++11 nullptr constexpr problem (Example from Chandler Carruth's speech on GoingNative 2012)
This file contains hidden or 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
#include <iostream> | |
struct S { int n; }; | |
struct X { X(int) {} }; | |
void f(void*) { | |
std::cerr << "Pointer!\n"; | |
} | |
void f(X) { | |
std::cerr << "X!\n"; | |
} | |
int main() { | |
f(S().n); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
eien@eien-ubuntu:
/dev/dev$ clang++ -std=c++11 problem.cpp/dev/dev$ ./a.outeien@eien-ubuntu:
Pointer!
eien@eien-ubuntu:
/dev/dev$ clang++ -std=c++03 problem.cpp -o a03/dev/dev$ ./a03eien@eien-ubuntu:
X!