blob: c610ff7ab0645ea04cdd7f2922e7618c48bb1327 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregor8e9bebd2008-10-21 16:13:35 +00002void f();
3void f(int);
4void f(int, float);
5void f(int, int);
6void f(int, ...);
7
8typedef float Float;
Chris Lattner5f4a6822008-11-23 23:12:31 +00009void f(int, Float); // expected-note {{previous declaration is here}}
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000010
Chris Lattner5f4a6822008-11-23 23:12:31 +000011int f(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000012
Chris Lattner5f4a6822008-11-23 23:12:31 +000013void g(void); // expected-note {{previous declaration is here}}
14int g(); // expected-error {{functions that differ only in their return type cannot be overloaded}}
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000015
Douglas Gregor9e7d9de2008-12-15 21:24:18 +000016typedef int INT;
17
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000018class X {
19 void f();
Douglas Gregor9e7d9de2008-12-15 21:24:18 +000020 void f(int); // expected-note {{previous declaration is here}}
Douglas Gregor1ca50c32008-11-21 15:36:28 +000021 void f() const;
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000022
Douglas Gregor9e7d9de2008-12-15 21:24:18 +000023 void f(INT); // expected-error{{cannot be redeclared}}
24
Chris Lattner5f4a6822008-11-23 23:12:31 +000025 void g(int); // expected-note {{previous declaration is here}}
26 void g(int, float); // expected-note {{previous declaration is here}}
27 int g(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000028
29 static void g(float);
Chris Lattner5f4a6822008-11-23 23:12:31 +000030 static void g(int); // expected-error {{static and non-static member functions with the same parameter types cannot be overloaded}}
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000031};