blob: 9190297dc05fd4e6cf4e4b0f92b6ee3a52c59cbe [file] [log] [blame]
Douglas Gregor558cb562009-04-02 01:08:08 +00001// RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ -
Douglas Gregor9b3064b2009-04-01 22:41:11 +00002
3/* This is a test of the various code modification hints that are
Douglas Gregorfe057ac2009-04-02 03:20:30 +00004 provided as part of warning or extension diagnostics. All of the
5 warnings will be fixed by -fixit, and the resulting file should
6 compile cleanly with -Werror -pedantic. */
Douglas Gregor9b3064b2009-04-01 22:41:11 +00007
Douglas Gregora3a83512009-04-01 23:51:29 +00008struct C1 {
9 virtual void f();
10 static void g();
11};
Douglas Gregor9b3064b2009-04-01 22:41:11 +000012struct C2 : virtual public virtual C1 { }; // expected-error{{duplicate}}
13
Douglas Gregora3a83512009-04-01 23:51:29 +000014virtual void C1::f() { } // expected-error{{'virtual' can only be specified inside the class definition}}
15
16static void C1::g() { } // expected-error{{'static' can only be specified inside the class definition}}
17
18template<int Value> struct CT { }; // expected-note{{previous use is here}}
Douglas Gregor9b3064b2009-04-01 22:41:11 +000019
20CT<10 >> 2> ct; // expected-warning{{require parentheses}}
Douglas Gregora3a83512009-04-01 23:51:29 +000021
22class C3 {
23public:
24 C3(C3, int i = 0); // expected-error{{copy constructor must pass its first argument by reference}}
25};
26
27struct CT<0> { }; // expected-error{{'template<>'}}
28
29template<> class CT<1> { }; // expected-error{{tag type}}
Anders Carlssonad26b732009-11-10 03:24:44 +000030
31// PR5444
32namespace PR5444 {
33 void foo(int x, int y = 0);
34 void foo(int x, int y = 0) { }
35
36 void foo(int = 0);
37 void foo(int = 0) { }
38}