From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaCXX/overload-decl.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 clang/test/SemaCXX/overload-decl.cpp (limited to 'clang/test/SemaCXX/overload-decl.cpp') diff --git a/clang/test/SemaCXX/overload-decl.cpp b/clang/test/SemaCXX/overload-decl.cpp new file mode 100644 index 0000000..c610ff7 --- /dev/null +++ b/clang/test/SemaCXX/overload-decl.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -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}} +}; -- cgit v1.2.3