From ec2b103c267a06a66e926f62cd96767b280f5cf5 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 2 Jun 2009 17:58:47 +0000 Subject: Import Clang, at r72732. --- test/SemaTemplate/instantiate-field.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/SemaTemplate/instantiate-field.cpp (limited to 'test/SemaTemplate/instantiate-field.cpp') diff --git a/test/SemaTemplate/instantiate-field.cpp b/test/SemaTemplate/instantiate-field.cpp new file mode 100644 index 000000000000..8e2a3758b0d7 --- /dev/null +++ b/test/SemaTemplate/instantiate-field.cpp @@ -0,0 +1,28 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template +struct X { + int x; + T y; // expected-error{{data member instantiated with function type}} + T* z; + T bitfield : 12; // expected-error{{bit-field 'bitfield' has non-integral type 'float'}} \ + // expected-error{{data member instantiated with function type}} + + mutable T x2; // expected-error{{data member instantiated with function type}} +}; + +void test1(const X *xi) { + int i1 = xi->x; + const int &i2 = xi->y; + int* ip1 = xi->z; + int i3 = xi->bitfield; + xi->x2 = 17; +} + +void test2(const X *xf) { + (void)xf->x; // expected-note{{in instantiation of template class 'struct X' requested here}} +} + +void test3(const X *xf) { + (void)xf->x; // expected-note{{in instantiation of template class 'struct X' requested here}} +} -- cgit v1.2.3