blob: 8e2a3758b0d713468e73073aa7b7ba3b1905254a [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregor3cf538d2009-03-11 18:59:21 +00002
3template<typename T>
4struct 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
14void 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
22void test2(const X<float> *xf) {
23 (void)xf->x; // expected-note{{in instantiation of template class 'struct X<float>' requested here}}
24}
25
26void test3(const X<int(int)> *xf) {
27 (void)xf->x; // expected-note{{in instantiation of template class 'struct X<int (int)>' requested here}}
28}