Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 1 | // Without PCH |
| 2 | // RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s |
| 3 | |
| 4 | // With PCH |
| 5 | // RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s |
| 6 | |
| 7 | #ifndef HEADER1 |
| 8 | #define HEADER1 |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | namespace NS { |
| 12 | |
| 13 | template <class _Tp, _Tp __v> |
| 14 | struct TS |
| 15 | { |
| 16 | static const _Tp value = __v; |
| 17 | }; |
| 18 | |
| 19 | template <class _Tp, _Tp __v> |
| 20 | const _Tp TS<_Tp, __v>::value; |
| 21 | |
| 22 | TS<int, 2> g1; |
| 23 | |
| 24 | } |
| 25 | |
| 26 | //===----------------------------------------------------------------------===// |
| 27 | #elif not defined(HEADER2) |
| 28 | #define HEADER2 |
| 29 | #if !defined(HEADER1) |
| 30 | #error Header inclusion order messed up |
| 31 | #endif |
| 32 | |
| 33 | int g2 = NS::TS<int, 2>::value; |
| 34 | |
| 35 | //===----------------------------------------------------------------------===// |
| 36 | #else |
| 37 | //===----------------------------------------------------------------------===// |
| 38 | |
| 39 | // expected-warning@+1 {{reached main file}} |
| 40 | #warning reached main file |
| 41 | |
| 42 | int g3 = NS::TS<int, 2>::value; |
| 43 | |
| 44 | //===----------------------------------------------------------------------===// |
| 45 | #endif |