[cfe-commits] r67817 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/SemaTemplate/nested-template.cpp
Douglas Gregor
dgregor at apple.com
Thu Mar 26 21:21:56 PDT 2009
Author: dgregor
Date: Thu Mar 26 23:21:56 2009
New Revision: 67817
URL: http://llvm.org/viewvc/llvm-project?rev=67817&view=rev
Log:
Tests and fixes for templates declared within (non-template)
classes. Test case from Anders Carlsson, fix from Piotr Rak!
Added:
cfe/trunk/test/SemaTemplate/nested-template.cpp (with props)
Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=67817&r1=67816&r2=67817&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu Mar 26 23:21:56 2009
@@ -600,10 +600,11 @@
// base classes, we never need to perform qualified lookup
// because all of the members are on top of the identifier
// chain.
- if (isa<RecordDecl>(Ctx) &&
- (R = LookupQualifiedName(Ctx, Name, NameKind, RedeclarationOnly)))
- return std::make_pair(true, R);
-
+ if (isa<RecordDecl>(Ctx)) {
+ R = LookupQualifiedName(Ctx, Name, NameKind, RedeclarationOnly);
+ if (R || RedeclarationOnly)
+ return std::make_pair(true, R);
+ }
if (Ctx->getParent() != Ctx->getLexicalParent()) {
// It is out of line defined C++ method or struct, we continue
// doing name lookup in parent context. Once we will find namespace
@@ -611,8 +612,8 @@
// using-directives later.
for (OutOfLineCtx = Ctx; OutOfLineCtx && !OutOfLineCtx->isFileContext();
OutOfLineCtx = OutOfLineCtx->getParent()) {
- if ((R = LookupQualifiedName(OutOfLineCtx, Name, NameKind,
- RedeclarationOnly)))
+ R = LookupQualifiedName(OutOfLineCtx, Name, NameKind, RedeclarationOnly);
+ if (R || RedeclarationOnly)
return std::make_pair(true, R);
}
}
Added: cfe/trunk/test/SemaTemplate/nested-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/nested-template.cpp?rev=67817&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/nested-template.cpp (added)
+++ cfe/trunk/test/SemaTemplate/nested-template.cpp Thu Mar 26 23:21:56 2009
@@ -0,0 +1,16 @@
+// RUN: clang-cc -fsyntax-only %s
+
+class A;
+
+class S {
+public:
+ template<typename T> struct A {
+ struct Nested {
+ typedef T type;
+ };
+ };
+};
+
+int i;
+S::A<int>::Nested::type *ip = &i;
+
Propchange: cfe/trunk/test/SemaTemplate/nested-template.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/SemaTemplate/nested-template.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/SemaTemplate/nested-template.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list