diff options
author | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
commit | f27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch) | |
tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/SemaCXX/overload-decl.cpp | |
download | FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz |
Import Clang, at r72732.
Diffstat (limited to 'test/SemaCXX/overload-decl.cpp')
-rw-r--r-- | test/SemaCXX/overload-decl.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/SemaCXX/overload-decl.cpp b/test/SemaCXX/overload-decl.cpp new file mode 100644 index 0000000..2bc832f --- /dev/null +++ b/test/SemaCXX/overload-decl.cpp @@ -0,0 +1,31 @@ +// RUN: clang-cc -fsyntax-only -verify %s +void f(); +void f(int); +void f(int, float); +void f(int, int); +void f(int, ...); + +typedef float Float; +void f(int, Float); // expected-note {{previous declaration is here}} + +int f(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}} + +void g(void); // expected-note {{previous declaration is here}} +int g(); // expected-error {{functions that differ only in their return type cannot be overloaded}} + +typedef int INT; + +class X { + void f(); + void f(int); // expected-note {{previous declaration is here}} + void f() const; + + void f(INT); // expected-error{{cannot be redeclared}} + + 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}} + + static void g(float); + static void g(int); // expected-error {{static and non-static member functions with the same parameter types cannot be overloaded}} +}; |