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 |
| 4 | provided as part of warning or extension diagnostics. Eventually, |
| 5 | we would like to actually try to perform the suggested |
| 6 | modifications and compile the result to test that no warnings |
| 7 | remain. */ |
| 8 | |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 9 | struct C1 { |
| 10 | virtual void f(); |
| 11 | static void g(); |
| 12 | }; |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 13 | struct C2 : virtual public virtual C1 { }; // expected-error{{duplicate}} |
| 14 | |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 15 | virtual void C1::f() { } // expected-error{{'virtual' can only be specified inside the class definition}} |
| 16 | |
| 17 | static void C1::g() { } // expected-error{{'static' can only be specified inside the class definition}} |
| 18 | |
| 19 | template<int Value> struct CT { }; // expected-note{{previous use is here}} |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 20 | |
| 21 | CT<10 >> 2> ct; // expected-warning{{require parentheses}} |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 22 | |
| 23 | class C3 { |
| 24 | public: |
| 25 | C3(C3, int i = 0); // expected-error{{copy constructor must pass its first argument by reference}} |
| 26 | }; |
| 27 | |
| 28 | struct CT<0> { }; // expected-error{{'template<>'}} |
| 29 | |
| 30 | template<> class CT<1> { }; // expected-error{{tag type}} |