[cfe-commits] Patch for review: Fix for bug 13086
Daniel Jasper
djasper at google.com
Thu Jun 14 08:51:21 PDT 2012
Look at incomplete FunctionTemplateDecls in order to determine whether a
CXXRecordDecl is complete. Fixes Bug 13086.
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 {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120614/09788063/attachment.html>
More information about the cfe-commits
mailing list