brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 850b8d1 Raw
46 lines · cpp
1// Without PCH2// RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s3 4// With PCH5// RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s6 7#ifndef HEADER18#define HEADER19//===----------------------------------------------------------------------===//10 11namespace NS {12 13template <class _Tp, _Tp __v>14struct TS15{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 HEADER229#if !defined(HEADER1)30#error Header inclusion order messed up31#endif32 33int g2 = NS::TS<int, 2>::value;34 35//===----------------------------------------------------------------------===//36#else37//===----------------------------------------------------------------------===//38 39// expected-warning@+1 {{reached main file}}40#warning reached main file41 42int g3 = NS::TS<int, 2>::value;43 44//===----------------------------------------------------------------------===//45#endif46