1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s
28e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregorvoid f();
38e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregorvoid f(int);
48e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregorvoid f(int, float);
58e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregorvoid f(int, int);
68e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregorvoid f(int, ...);
78e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor
88e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregortypedef float Float;
95f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattnervoid f(int, Float); // expected-note {{previous declaration is here}}
108e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor
115f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattnerint f(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
128e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor
135f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattnervoid g(void); // expected-note {{previous declaration is here}}
145f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattnerint g(); // expected-error {{functions that differ only in their return type cannot be overloaded}}
158e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor
169e7d9de3ef538c1473248238b76a6d7b16f5f684Douglas Gregortypedef int INT;
179e7d9de3ef538c1473248238b76a6d7b16f5f684Douglas Gregor
188e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregorclass X {
198e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor  void f();
209e7d9de3ef538c1473248238b76a6d7b16f5f684Douglas Gregor  void f(int); // expected-note {{previous declaration is here}}
211ca50c3f541dd637063b9d186a7ea193e3440a48Douglas Gregor  void f() const;
228e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor
239e7d9de3ef538c1473248238b76a6d7b16f5f684Douglas Gregor  void f(INT); // expected-error{{cannot be redeclared}}
249e7d9de3ef538c1473248238b76a6d7b16f5f684Douglas Gregor
255f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattner  void g(int); // expected-note {{previous declaration is here}}
265f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattner  void g(int, float); // expected-note {{previous declaration is here}}
275f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattner  int g(int, Float); // expected-error {{functions that differ only in their return type cannot be overloaded}}
288e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor
29fa0d3f815e6de3f5129572b179b8027c4a3eecdeEli Friedman  static void g(float); // expected-note {{previous declaration is here}}
305f4a6829dc58cab2f76e2b98492859aa3b91e3f2Chris Lattner  static void g(int); // expected-error {{static and non-static member functions with the same parameter types cannot be overloaded}}
31fa0d3f815e6de3f5129572b179b8027c4a3eecdeEli Friedman  static void g(float); // expected-error {{class member cannot be redeclared}}
3262e9370d9da9ee4f675da52d559a79c93c30642eDavid Majnemer
330e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  void h(); // expected-note {{previous declaration is here}}
340e2c34f92f00628d48968dfea096d36381f494cbStephen Hines  void h() __restrict; // expected-error {{class member cannot be redeclared}}
358e9bebdea69c590dedfbf27374114cb76fe12fbdDouglas Gregor};
367a525acb2ba57ea03cfc8f843bfb2e5f81caf65fRafael Espindola
377a525acb2ba57ea03cfc8f843bfb2e5f81caf65fRafael Espindolaint main() {} // expected-note {{previous definition is here}}
387a525acb2ba57ea03cfc8f843bfb2e5f81caf65fRafael Espindolaint main(int,char**) {} // expected-error {{conflicting types for 'main'}}
39