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