Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | 3cf538d | 2009-03-11 18:59:21 +0000 | [diff] [blame] | 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 | } |