Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | a6f0f9d | 2009-08-31 19:52:13 +0000 | [diff] [blame] | 2 | |
| 3 | class X { |
| 4 | public: |
| 5 | int operator++(); |
| 6 | operator int(); |
| 7 | }; |
| 8 | |
| 9 | void test() { |
| 10 | X x; |
| 11 | int i; |
| 12 | |
| 13 | i = x.operator++(); |
| 14 | i = x.operator int(); |
| 15 | x.operator--(); // expected-error{{no member named 'operator--'}} |
| 16 | x.operator float(); // expected-error{{no member named 'operator float'}} |
Nick Lewycky | 9fa8e56 | 2010-11-03 17:52:57 +0000 | [diff] [blame] | 17 | x.operator; // expected-error{{expected a type}} |
Douglas Gregor | a6f0f9d | 2009-08-31 19:52:13 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | void test2() { |
| 21 | X *x; |
| 22 | int i; |
| 23 | |
| 24 | i = x->operator++(); |
| 25 | i = x->operator int(); |
| 26 | x->operator--(); // expected-error{{no member named 'operator--'}} |
| 27 | x->operator float(); // expected-error{{no member named 'operator float'}} |
Nick Lewycky | 9fa8e56 | 2010-11-03 17:52:57 +0000 | [diff] [blame] | 28 | x->operator; // expected-error{{expected a type}} |
Douglas Gregor | a6f0f9d | 2009-08-31 19:52:13 +0000 | [diff] [blame] | 29 | } |