From 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 20 Feb 2011 13:06:31 +0000 Subject: Vendor import of clang trunk r126079: http://llvm.org/svn/llvm-project/cfe/trunk@126079 --- test/SemaTemplate/default-expr-arguments.cpp | 88 +++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) (limited to 'test/SemaTemplate/default-expr-arguments.cpp') diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp index 7c3525a..5d301be 100644 --- a/test/SemaTemplate/default-expr-arguments.cpp +++ b/test/SemaTemplate/default-expr-arguments.cpp @@ -151,7 +151,7 @@ namespace pr5301 { namespace PR5810 { template struct allocator { - allocator() { int a[sizeof(T) ? -1 : -1]; } // expected-error2 {{array size is negative}} + allocator() { int a[sizeof(T) ? -1 : -1]; } // expected-error2 {{array with a negative size}} }; template @@ -206,3 +206,89 @@ namespace InstForInit { Holder h(i); } }; + +namespace PR5810b { + template + T broken() { + T t; + double**** not_it = t; + } + + void f(int = broken()); + void g() { f(17); } +} + +namespace PR5810c { + template + struct X { + X() { + T t; + double *****p = t; // expected-error{{cannot initialize a variable of type 'double *****' with an lvalue of type 'int'}} + } + X(const X&) { } + }; + + struct Y : X { // expected-note{{instantiation of}} + }; + + void f(Y y = Y()); + + void g() { f(); } +} + +namespace PR8127 { + template< typename T > class PointerClass { + public: + PointerClass( T * object_p ) : p_( object_p ) { + p_->acquire(); + } + private: + T * p_; + }; + + class ExternallyImplementedClass; + + class MyClass { + void foo( PointerClass = 0 ); + }; +} + +namespace rdar8427926 { + template + struct Boom { + ~Boom() { + T t; + double *******ptr = t; // expected-error 2{{cannot initialize}} + } + }; + + Boom *bfp; + + struct X { + void f(Boom = Boom()) { } // expected-note{{requested here}} + void g(int x = (delete bfp, 0)); // expected-note{{requested here}} + }; + + void test(X *x) { + x->f(); + x->g(); + } +} + +namespace PR8401 { + template + struct A { + A() { T* x = 1; } // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} + }; + + template + struct B { + B(const A& a = A()); // expected-note{{in instantiation of}} + }; + + void f(B b = B()); + + void g() { + f(); + } +} -- cgit v1.1