Closed by commit rL219551 (authored by @ehsan).
REPOSITORY
rL LLVM
http://reviews.llvm.org/D5718
Files:
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/SemaCXX/warn-unused-private-field-delayed-template.cpp
Index: cfe/trunk/lib/Sema/Sema.cpp
===================================================================
--- cfe/trunk/lib/Sema/Sema.cpp
+++ cfe/trunk/lib/Sema/Sema.cpp
@@ -545,7 +545,12 @@
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();
+ // If the template function is marked as late template parsed at this point,
+ // it has not been instantiated and therefore we have not performed semantic
+ // analysis on it yet, so we cannot know if the type can be considered
+ // complete.
+ Complete = !F->getTemplatedDecl()->isLateTemplateParsed() &&
+ F->getTemplatedDecl()->isDefined();
else if (const CXXRecordDecl *R = dyn_cast<CXXRecordDecl>(*I)) {
if (R->isInjectedClassName())
continue;
Index: cfe/trunk/test/SemaCXX/warn-unused-private-field-delayed-template.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/warn-unused-private-field-delayed-template.cpp
+++ cfe/trunk/test/SemaCXX/warn-unused-private-field-delayed-template.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fdelayed-template-parsing -Wunused-private-field -Wused-but-marked-unused -Wno-uninitialized -verify -std=c++11 %s
+// expected-no-diagnostics
+
+class EverythingMayBeUsed {
+ int x;
+public:
+ template <class T>
+ void f() {
+ x = 0;
+ }
+};
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits