gcc/testsuite/g++.dg/cpp0x/nullptr07.C
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | // Test compare to int |
| 4 | |
| 5 | void fun() |
| 6 | { |
| 7 | int n = 0; |
| 8 | if( n == nullptr ); // { dg-error "invalid operands of types " } |
| 9 | const int m = 1; |
| 10 | if( m == nullptr ); // { dg-error "invalid operands of types " } |
| 11 | decltype(nullptr) mynull = 0; |
| 12 | if( n == mynull ); // { dg-error "invalid operands of types " } |
| 13 | if( m == mynull ); // { dg-error "invalid operands of types " } |
| 14 | } |