From 21920e375805cf0b45b0e78f577502ef0229dd1d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 1 Dec 2009 17:24:26 +0000 Subject: Move the checking of overridden virtual functions into the code path common to both parsing and template instantiation, so that we'll find overridden virtuals for member functions of class templates when they are instantiated. Additionally, factor out the checking for pure virtual functions, so that it will be executed both at parsing time and at template instantiation time. These changes fix PR5656 (for real), although one more tweak w.r.t. member function templates will be coming along shortly. llvm-svn: 90241 --- clang/test/SemaCXX/virtual-override.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'clang/test/SemaCXX/virtual-override.cpp') diff --git a/clang/test/SemaCXX/virtual-override.cpp b/clang/test/SemaCXX/virtual-override.cpp index 7ace886ff0d..6024dae8386 100644 --- a/clang/test/SemaCXX/virtual-override.cpp +++ b/clang/test/SemaCXX/virtual-override.cpp @@ -112,3 +112,16 @@ class X0 { class X1 : public X0 { void f0() = 0; }; + +template +struct Foo : Base { + void f() = 0; // expected-error{{not virtual and cannot be declared pure}} +}; + +struct Base1 { virtual void f(); }; +struct Base2 { }; + +void test() { + Foo f1; + Foo f2; // expected-note{{instantiation}} +} -- cgit v1.2.3