Douglas Gregor | 558cb56 | 2009-04-02 01:08:08 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 2 | |
| 3 | /* This is a test of the various code modification hints that are |
Douglas Gregor | fe057ac | 2009-04-02 03:20:30 +0000 | [diff] [blame] | 4 | 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 Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 7 | |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 8 | struct C1 { |
| 9 | virtual void f(); |
| 10 | static void g(); |
| 11 | }; |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 12 | struct C2 : virtual public virtual C1 { }; // expected-error{{duplicate}} |
| 13 | |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 14 | virtual void C1::f() { } // expected-error{{'virtual' can only be specified inside the class definition}} |
| 15 | |
| 16 | static void C1::g() { } // expected-error{{'static' can only be specified inside the class definition}} |
| 17 | |
| 18 | template<int Value> struct CT { }; // expected-note{{previous use is here}} |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 19 | |
| 20 | CT<10 >> 2> ct; // expected-warning{{require parentheses}} |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 21 | |
| 22 | class C3 { |
| 23 | public: |
| 24 | C3(C3, int i = 0); // expected-error{{copy constructor must pass its first argument by reference}} |
| 25 | }; |
| 26 | |
| 27 | struct CT<0> { }; // expected-error{{'template<>'}} |
| 28 | |
| 29 | template<> class CT<1> { }; // expected-error{{tag type}} |
Anders Carlsson | ad26b73 | 2009-11-10 03:24:44 +0000 | [diff] [blame^] | 30 | |
| 31 | // PR5444 |
| 32 | namespace 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 | } |