]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaTemplate/instantiate-field.cpp
Update clang to r94309.
[FreeBSD/FreeBSD.git] / test / SemaTemplate / instantiate-field.cpp
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 template<typename T>
4 struct X {
5   int x;
6   T y; // expected-error{{data member instantiated with function type}}
7   T* z;
8   T bitfield : 12; // expected-error{{bit-field 'bitfield' has non-integral type 'float'}} \
9                   // expected-error{{data member instantiated with function type}}
10
11   mutable T x2; // expected-error{{data member instantiated with function type}}
12 };
13
14 void test1(const X<int> *xi) {
15   int i1 = xi->x;
16   const int &i2 = xi->y;
17   int* ip1 = xi->z;
18   int i3 = xi->bitfield;
19   xi->x2 = 17;
20 }
21
22 void test2(const X<float> *xf) {
23   (void)xf->x; // expected-note{{in instantiation of template class 'struct X<float>' requested here}}
24 }
25
26 void test3(const X<int(int)> *xf) {
27   (void)xf->x; // expected-note{{in instantiation of template class 'struct X<int (int)>' requested here}}
28 }