blob: 9814725085e9bc1458a8adb298db4f0aa4c50aee [file] [log] [blame]
Douglas Gregor8e9bebd2008-10-21 16:13:35 +00001// 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;
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
16class X {
17 void f();
18 void f(int);
Douglas Gregor1ca50c32008-11-21 15:36:28 +000019 void f() const;
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000020
Chris Lattner5f4a6822008-11-23 23:12:31 +000021 void g(int); // expected-note {{previous declaration is here}}
22 void g(int, float); // expected-note {{previous declaration is here}}
23 int g(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
Douglas Gregor8e9bebd2008-10-21 16:13:35 +000024
25 static void g(float);
Chris Lattner5f4a6822008-11-23 23:12:31 +000026 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 +000027};