summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-01-26 01:37:01 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-01-26 01:37:01 +0000
commit5ef36534d758f2a40270d355026a40635f438ab7 (patch)
tree4f7577c78fbb4661fc416f271d902a7477c6d72c /test
parent3398078a417447cf6ab55a999b88871b8dae9ec0 (diff)
downloadclang-5ef36534d758f2a40270d355026a40635f438ab7.tar.gz
[Sema] Incomplete types are OK for covariant returns
Per C++14 [class.virtual]p8, it is OK for the return type's class type to be incomplete so long as the return type is the same between the base and complete classes. This fixes PR26297. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258768 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/SemaCXX/virtual-override.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp
index ec884f3632..4249117848 100644
--- a/test/SemaCXX/virtual-override.cpp
+++ b/test/SemaCXX/virtual-override.cpp
@@ -289,3 +289,15 @@ namespace PR8168 {
static void foo() {} // expected-error{{'static' member function 'foo' overrides a virtual function}}
};
}
+
+namespace PR26297 {
+struct Incomplete;
+
+struct Base {
+ virtual const Incomplete *meow() = 0;
+};
+
+struct Derived : Base {
+ virtual Incomplete *meow() override { return nullptr; }
+};
+}