[cfe-commits] Patch for review: Fix for bug 13086
Chandler Carruth
chandlerc at google.com
Thu Jun 14 11:21:40 PDT 2012
On Thu, Jun 14, 2012 at 8:51 AM, Daniel Jasper <djasper at google.com> wrote:
> Look at incomplete FunctionTemplateDecls in order to determine whether a
> CXXRecordDecl is complete. Fixes Bug 13086.
>
LGTM
For future reference, please attach the patch rather than pasting it --
email clients like to line wrap pasted patches...
>
> diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
> index e0d405d..39338f9 100644
> --- a/lib/Sema/Sema.cpp
> +++ b/lib/Sema/Sema.cpp
> @@ -444,6 +444,8 @@ static bool MethodsAndNestedClassesComplete(const
> CXXRecordDecl *RD,
> I != E && Complete; ++I) {
> if (const CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(*I))
> Complete = M->isDefined() || (M->isPure() &&
> !isa<CXXDestructorDecl>(M));
> + else if (const FunctionTemplateDecl *F =
> dyn_cast<FunctionTemplateDecl>(*I))
> + Complete = F->getTemplatedDecl()->isDefined();
> else if (const CXXRecordDecl *R = dyn_cast<CXXRecordDecl>(*I)) {
> if (R->isInjectedClassName())
> continue;
> diff --git a/test/SemaCXX/warn-unused-member.cpp
> b/test/SemaCXX/warn-unused-member.cpp
> index 00de8a9..9ec9df6 100644
> --- a/test/SemaCXX/warn-unused-member.cpp
> +++ b/test/SemaCXX/warn-unused-member.cpp
> @@ -142,6 +142,13 @@ class EverythingUsed {
> int by_initializer_;
> };
>
> +namespace templates {
> +class B {
> + template <typename T> void f(T t);
> + int a;
> +};
> +} // namespace templates
> +
> namespace mutual_friends {
> // Undefined methods make mutual friends undefined.
> class A {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120614/1d88015a/attachment.html>
More information about the cfe-commits
mailing list