]> granicus.if.org Git - clang/commitdiff
It's OK for a return type to be incomplete if it's being defined.
authorAnders Carlsson <andersca@mac.com>
Thu, 31 Dec 2009 18:54:35 +0000 (18:54 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 31 Dec 2009 18:54:35 +0000 (18:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92367 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp

index d6aa240df4c0542be9ed139ed47064b171fb107c..204d7764682bb65d83f2afd199de23c62f6ccf08 100644 (file)
@@ -5532,10 +5532,13 @@ bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
   //   If the return type of D::f differs from the return type of B::f, the 
   //   class type in the return type of D::f shall be complete at the point of
   //   declaration of D::f or shall be the class type D.
-  if (RequireCompleteType(New->getLocation(), NewClassTy, 
-                          PDiag(diag::err_covariant_return_incomplete)
-                            << New->getDeclName()))
+  if (const RecordType *RT = NewClassTy->getAs<RecordType>()) {
+    if (!RT->isBeingDefined() &&
+        RequireCompleteType(New->getLocation(), NewClassTy, 
+                            PDiag(diag::err_covariant_return_incomplete)
+                              << New->getDeclName()))
     return true;
+  }
 
   if (!Context.hasSameUnqualifiedType(NewClassTy, OldClassTy)) {
     // Check if the new class derives from the old class.