diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-01 17:24:26 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-01 17:24:26 +0000 |
commit | 21920e375805cf0b45b0e78f577502ef0229dd1d (patch) | |
tree | 0ae7d8859fe61ff1beb197b1fe103ecda43767cd /clang/test/SemaCXX/virtual-override.cpp | |
parent | defc47088a189fab9f6597d69f33b873d556e05d (diff) | |
download | bcm5719-llvm-21920e375805cf0b45b0e78f577502ef0229dd1d.tar.gz bcm5719-llvm-21920e375805cf0b45b0e78f577502ef0229dd1d.zip |
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
Diffstat (limited to 'clang/test/SemaCXX/virtual-override.cpp')
-rw-r--r-- | clang/test/SemaCXX/virtual-override.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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 <typename Base> +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<Base1> f1; + Foo<Base2> f2; // expected-note{{instantiation}} +} |