overload-decl.cpp revision 1ca50c3f541dd637063b9d186a7ea193e3440a48
1// RUN: clang -fsyntax-only -verify %s
2void f();
3void f(int);
4void f(int, float);
5void f(int, int);
6void f(int, ...);
7
8typedef float Float;
9void f(int, Float); // expected-error {{error: previous declaration is here}}
10
11int f(int, Float); // expected-error {{error: functions that differ only in their return type cannot be overloaded}}
12
13void g(void); // expected-error {{error: previous declaration is here}}
14int g(); // expected-error {{error: functions that differ only in their return type cannot be overloaded}}
15
16class X {
17  void f();
18  void f(int);
19  void f() const;
20
21  void g(int); // expected-error {{error: previous declaration is here}}
22  void g(int, float); // expected-error {{error: previous declaration is here}}
23  int g(int, Float); // expected-error {{error: functions that differ only in their return type cannot be overloaded}}
24
25  static void g(float);
26  static void g(int); // expected-error {{error: static and non-static member functions with the same parameter types cannot be overloaded}}
27};
28