1 // Test C++ chained PCH functionality
4 // RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s
7 // RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s
10 // RUN: %clang_cc1 -fsyntax-only -verify -fmodules %s -chain-include %s -chain-include %s
12 // expected-no-diagnostics
16 //===----------------------------------------------------------------------===//
17 // Primary header for C++ chained PCH test
21 // Name not appearing in dependent
31 struct S
{ typedef int G
; };
33 // Partially specialize
35 struct S
<T
*> { typedef int H
; };
37 template <typename T
> struct TS2
;
38 typedef TS2
<int> TS2int
;
40 template <typename T
> struct TestBaseSpecifiers
{ };
41 template<typename T
> struct TestBaseSpecifiers2
: TestBaseSpecifiers
<T
> { };
45 static const int value
= 0;
46 static const int value2
;
49 const int TS3
<T
>::value
;
51 const int TS3
<T
>::value2
= 1;
52 // Instantiate struct, but not value.
53 struct instantiate
: TS3
<int> {};
58 //===----------------------------------------------------------------------===//
59 #elif not defined(HEADER2)
62 #error Header inclusion order messed up
65 //===----------------------------------------------------------------------===//
66 // Dependent header for C++ chained PCH test
68 // Overload function from primary
71 // Add function with different name
76 // Overload function from primary
83 // Specialize template from primary
85 struct S
<int> { typedef int I
; };
87 // Partially specialize
89 struct S
<T
&> { typedef int J
; };
91 // Specialize previous partial specialization
93 struct S
<int *> { typedef int K
; };
95 // Specialize the partial specialization from this file
97 struct S
<int &> { typedef int L
; };
99 template <typename T
> struct TS2
{ };
101 struct TestBaseSpecifiers3
{ };
102 struct TestBaseSpecifiers4
: TestBaseSpecifiers3
{ };
107 // Instantiate TS3's members.
108 static const int ts3m1
= TS3
<int>::value
;
109 extern int arr
[TS3
<int>::value2
];
111 // Redefinition of typedef
114 //===----------------------------------------------------------------------===//
116 //===----------------------------------------------------------------------===//
129 typedef S
<double>::G T1
;
130 typedef S
<double *>::H T2
;
131 typedef S
<int>::I T3
;
132 typedef S
<double &>::J T4
;
133 typedef S
<int *>::K T5
;
134 typedef S
<int &>::L T6
;
142 // Should have remembered that there is a definition.
143 static const int ts3m2
= TS3
<int>::value
;
144 int arr
[TS3
<int>::value2
];
146 //===----------------------------------------------------------------------===//