From: Anders Carlsson Date: Thu, 31 Dec 2009 18:54:35 +0000 (+0000) Subject: It's OK for a return type to be incomplete if it's being defined. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac4c939c2dfca2dc5b785169670125511ea5bb62;p=clang It's OK for a return type to be incomplete if it's being defined. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92367 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index d6aa240df4..204d776468 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -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()) { + 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.