Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 void f();
      3 void f(int);
      4 void f(int, float);
      5 void f(int, int);
      6 void f(int, ...);
      7 
      8 typedef float Float;
      9 void f(int, Float); // expected-note {{previous declaration is here}}
     10 
     11 int f(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
     12 
     13 void g(void); // expected-note {{previous declaration is here}}
     14 int g(); // expected-error {{functions that differ only in their return type cannot be overloaded}}
     15 
     16 typedef int INT;
     17 
     18 class X {
     19   void f();
     20   void f(int); // expected-note {{previous declaration is here}}
     21   void f() const;
     22 
     23   void f(INT); // expected-error{{cannot be redeclared}}
     24 
     25   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}}
     28 
     29   static void g(float); // expected-note {{previous declaration is here}}
     30   static void g(int); // expected-error {{static and non-static member functions with the same parameter types cannot be overloaded}}
     31   static void g(float); // expected-error {{class member cannot be redeclared}}
     32 
     33   void h(); // expected-note {{previous declaration is here}}
     34   void h() __restrict; // expected-error {{class member cannot be redeclared}}
     35 };
     36 
     37 int main() {} // expected-note {{previous definition is here}}
     38 int main(int,char**) {} // expected-error {{conflicting types for 'main'}}
     39