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
11namespace NS {
12
13template <class _Tp, _Tp __v>
14struct TS
15{
16  static const _Tp value = __v;
17};
18
19template <class _Tp, _Tp __v>
20const _Tp TS<_Tp, __v>::value;
21
22TS<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
33int 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
42int g3 = NS::TS<int, 2>::value;
43
44//===----------------------------------------------------------------------===//
45#endif
46