2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2008-10-22 00:13:35 +08:00
|
|
|
void f();
|
|
|
|
void f(int);
|
|
|
|
void f(int, float);
|
|
|
|
void f(int, int);
|
|
|
|
void f(int, ...);
|
|
|
|
|
|
|
|
typedef float Float;
|
2008-11-24 07:12:31 +08:00
|
|
|
void f(int, Float); // expected-note {{previous declaration is here}}
|
2008-10-22 00:13:35 +08:00
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
int f(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
|
2008-10-22 00:13:35 +08:00
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
void g(void); // expected-note {{previous declaration is here}}
|
|
|
|
int g(); // expected-error {{functions that differ only in their return type cannot be overloaded}}
|
2008-10-22 00:13:35 +08:00
|
|
|
|
2008-12-16 05:24:18 +08:00
|
|
|
typedef int INT;
|
|
|
|
|
2008-10-22 00:13:35 +08:00
|
|
|
class X {
|
|
|
|
void f();
|
2008-12-16 05:24:18 +08:00
|
|
|
void f(int); // expected-note {{previous declaration is here}}
|
2008-11-21 23:36:28 +08:00
|
|
|
void f() const;
|
2008-10-22 00:13:35 +08:00
|
|
|
|
2008-12-16 05:24:18 +08:00
|
|
|
void f(INT); // expected-error{{cannot be redeclared}}
|
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
void g(int); // expected-note {{previous declaration is here}}
|
|
|
|
void g(int, float); // expected-note {{previous declaration is here}}
|
|
|
|
int g(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
|
2008-10-22 00:13:35 +08:00
|
|
|
|
|
|
|
static void g(float);
|
2008-11-24 07:12:31 +08:00
|
|
|
static void g(int); // expected-error {{static and non-static member functions with the same parameter types cannot be overloaded}}
|
2008-10-22 00:13:35 +08:00
|
|
|
};
|
2013-01-12 09:47:40 +08:00
|
|
|
|
|
|
|
int main() {} // expected-note {{previous definition is here}}
|
|
|
|
int main(int,char**) {} // expected-error {{conflicting types for 'main'}}
|