Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | void f(); |
| 3 | void f(int); |
| 4 | void f(int, float); |
| 5 | void f(int, int); |
| 6 | void f(int, ...); |
| 7 | |
| 8 | typedef float Float; |
| 9 | void f(int, Float); // expected-error {{error: previous declaration is here}} |
| 10 | |
| 11 | int f(int, Float); // expected-error {{error: functions that differ only in their return type cannot be overloaded}} |
| 12 | |
| 13 | void g(void); // expected-error {{error: previous declaration is here}} |
| 14 | int g(); // expected-error {{error: functions that differ only in their return type cannot be overloaded}} |
| 15 | |
| 16 | class X { |
| 17 | void f(); |
| 18 | void f(int); |
| 19 | |
| 20 | // FIXME: can't test this until we can handle const methods. |
| 21 | // void f() const; |
| 22 | |
| 23 | void g(int); // expected-error {{error: previous declaration is here}} |
| 24 | void g(int, float); // expected-error {{error: previous declaration is here}} |
| 25 | int g(int, Float); // expected-error {{error: functions that differ only in their return type cannot be overloaded}} |
| 26 | |
| 27 | static void g(float); |
| 28 | static void g(int); // expected-error {{error: static and non-static member functions with the same parameter types cannot be overloaded}} |
| 29 | }; |