// RUN: %clang_cc1 -fsyntax-only -verify %s // Tests various places where requiring a complete type involves // instantiation of that type. template struct X { X(T); T f; // expected-error{{data member instantiated with function type 'float (int)'}} \ // expected-error{{data member instantiated with function type 'int (int)'}} \ // expected-error{{data member instantiated with function type 'char (char)'}} \ // expected-error{{data member instantiated with function type 'short (short)'}} \ // expected-error{{data member instantiated with function type 'float (float)'}} }; X f() { return 0; } struct XField { X xf; // expected-note{{in instantiation of template class 'struct X' requested here}} }; void test_subscript(X *ptr1, X *ptr2, int i) { (void)ptr1[i]; (void)ptr2[i]; // expected-note{{in instantiation of template class 'struct X' requested here}} } void test_arith(X *ptr1, X *ptr2, X *ptr3, X *ptr4) { (void)(ptr1 + 5); // FIXME: if I drop the ')' after void, below, it still parses (!) (void)(5 + ptr2); (void)(ptr3 + 5); // expected-note{{in instantiation of template class 'struct X' requested here}} (void)(5 + ptr4); // expected-note{{in instantiation of template class 'struct X' requested here}} } void test_new() { (void)new X(0); (void)new X; // expected-note{{in instantiation of template class 'struct X' requested here}} } void test_memptr(X *p1, long X::*pm1, X *p2, long (X::*pm2)(long)) { (void)(p1->*pm1); (void)((p2->*pm2)(0)); } // Reference binding to a base template struct X1 { }; template struct X2 : public T { }; void refbind_base(X2 > &x2) { X1 &x1 = x2; } // Enumerate constructors for user-defined conversion. template struct X3 { X3(T); }; void enum_constructors(X1 &x1) { X3 > x3 = x1; }