[cfe-commits] r158469 - in /cfe/trunk: lib/Sema/Sema.cpp test/SemaCXX/warn-unused-member.cpp
Daniel Jasper
djasper at google.com
Thu Jun 14 13:56:07 PDT 2012
Author: djasper
Date: Thu Jun 14 15:56:06 2012
New Revision: 158469
URL: http://llvm.org/viewvc/llvm-project?rev=158469&view=rev
Log:
Look at incomplete FunctionTemplateDecls in order to determine whether
a CXXRecordDecl is complete. Fixes Bug 13086.
Modified:
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/SemaCXX/warn-unused-member.cpp
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=158469&r1=158468&r2=158469&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Thu Jun 14 15:56:06 2012
@@ -444,6 +444,8 @@
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;
Modified: cfe/trunk/test/SemaCXX/warn-unused-member.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unused-member.cpp?rev=158469&r1=158468&r2=158469&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-unused-member.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-unused-member.cpp Thu Jun 14 15:56:06 2012
@@ -142,6 +142,13 @@
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 {
More information about the cfe-commits
mailing list