fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct nat {};
  5. int nat::*get_false() { return 0; }
  6.  
  7. int main() {
  8. bool b = get_false(); // ok
  9. int n = get_false(); // ng
  10. cout << b << n << endl;
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:9:20: error: cannot convert ‘int nat::*’ to ‘int’ in initialization
  int n = get_false(); // ng
                    ^
stdout
Standard output is empty