gcc/testsuite/g++.dg/conversion/cond4.C
raw| 1 | // Origin: PR c++/45383 |
| 2 | // { dg-do run } |
| 3 | |
| 4 | struct null { |
| 5 | null() {} |
| 6 | template<class T> |
| 7 | operator T*() const { |
| 8 | return 0; |
| 9 | } |
| 10 | |
| 11 | template<class C, class T> |
| 12 | operator T C::*() const { |
| 13 | return 0; |
| 14 | } |
| 15 | private: |
| 16 | null(const null&); |
| 17 | null& operator=(const null&); |
| 18 | void operator&() const; |
| 19 | }; |
| 20 | |
| 21 | static struct null null; |
| 22 | |
| 23 | int |
| 24 | main() |
| 25 | { |
| 26 | int* ptr = null; |
| 27 | if (ptr == null) |
| 28 | return 0; |
| 29 | if (ptr != null) |
| 30 | return 1; |
| 31 | } |