From 36c49e3f258dced101949edabd72e9bc3f1dedc4 Mon Sep 17 00:00:00 2001 From: dim Date: Fri, 17 Sep 2010 15:54:40 +0000 Subject: Vendor import of clang r114020 (from the release_28 branch): http://llvm.org/svn/llvm-project/cfe/branches/release_28@114020 Approved by: rpaulo (mentor) --- test/SemaCXX/abstract.cpp | 71 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 4 deletions(-) (limited to 'test/SemaCXX/abstract.cpp') diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp index f64fda4..ad079c2 100644 --- a/test/SemaCXX/abstract.cpp +++ b/test/SemaCXX/abstract.cpp @@ -67,20 +67,23 @@ class F { virtual void f() = 0; // expected-note {{pure virtual function 'f'}} }; +// Diagnosing in these cases is prohibitively expensive. We still +// diagnose at the function definition, of course. + class Abstract; -void t7(Abstract a); // expected-error {{parameter type 'Abstract' is an abstract class}} +void t7(Abstract a); void t8() { - void h(Abstract a); // expected-error {{parameter type 'Abstract' is an abstract class}} + void h(Abstract a); } namespace N { -void h(Abstract a); // expected-error {{parameter type 'Abstract' is an abstract class}} +void h(Abstract a); } class Abstract { - virtual void f() = 0; // expected-note {{pure virtual function 'f'}} + virtual void f() = 0; }; // @@ -186,3 +189,63 @@ namespace test1 { C c; } } + +// rdar://problem/8302168 +namespace test2 { + struct X1 { + virtual void xfunc(void) = 0; // expected-note {{pure virtual function}} + void g(X1 parm7); // expected-error {{parameter type 'test2::X1' is an abstract class}} + void g(X1 parm8[2]); // expected-error {{array of abstract class type 'test2::X1'}} + }; + + template + struct X2 { + virtual void xfunc(void) = 0; // expected-note {{pure virtual function}} + void g(X2 parm10); // expected-error {{parameter type 'X2' is an abstract class}} + void g(X2 parm11[2]); // expected-error {{array of abstract class type 'X2'}} + }; +} + +namespace test3 { + struct A { // expected-note {{not complete until}} + A x; // expected-error {{field has incomplete type}} + virtual void abstract() = 0; + }; + + struct B { // expected-note {{not complete until}} + virtual void abstract() = 0; + B x; // expected-error {{field has incomplete type}} + }; + + struct C { + static C x; // expected-error {{abstract class}} + virtual void abstract() = 0; // expected-note {{pure virtual function}} + }; + + struct D { + virtual void abstract() = 0; // expected-note {{pure virtual function}} + static D x; // expected-error {{abstract class}} + }; +} + +namespace test4 { + template struct A { + A x; // expected-error {{abstract class}} + virtual void abstract() = 0; // expected-note {{pure virtual function}} + }; + + template struct B { + virtual void abstract() = 0; // expected-note {{pure virtual function}} + B x; // expected-error {{abstract class}} + }; + + template struct C { + static C x; // expected-error {{abstract class}} + virtual void abstract() = 0; // expected-note {{pure virtual function}} + }; + + template struct D { + virtual void abstract() = 0; // expected-note {{pure virtual function}} + static D x; // expected-error {{abstract class}} + }; +} -- cgit v1.1