brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 5d1df89 Raw
56 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s 2void f();3void f(int);4void f(int, float); 5void f(int, int);6void f(int, ...);7 8typedef float Float;9void f(int, Float); // expected-note {{previous declaration is here}}10 11int f(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}12 13void g(void); // expected-note {{previous declaration is here}}14int g(); // expected-error {{functions that differ only in their return type cannot be overloaded}}15 16typedef int INT;17 18class 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 37int main() {} // expected-note {{previous definition is here}}38int main(int,char**) {} // expected-error {{conflicting types for 'main'}}39 40 41namespace GH93456 {42 43struct X {44  static void f(); // expected-note {{previous declaration is here}}45  void f() const;46  // expected-error@-1 {{static and non-static member functions with the same parameter types cannot be overloaded}}47};48 49struct Y {50  void f() const; // expected-note {{previous declaration is here}}51  static void f();52  // expected-error@-1 {{static and non-static member functions with the same parameter types cannot be overloaded}}53};54 55}56