[cfe-commits] r93240 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaTemplate/typo-dependent-name.cpp
Douglas Gregor
dgregor at apple.com
Tue Jan 12 09:06:21 PST 2010
Author: dgregor
Date: Tue Jan 12 11:06:20 2010
New Revision: 93240
URL: http://llvm.org/viewvc/llvm-project?rev=93240&view=rev
Log:
When determining whether a given name is a template in a dependent
context, do not attempt typo correction. This harms performance (as
Abramo noted) and can cause some amusing errors, as in this new
testcase.
Added:
cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp (with props)
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=93240&r1=93239&r2=93240&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Tue Jan 12 11:06:20 2010
@@ -194,7 +194,8 @@
ObjectTypeSearchedInScope = true;
}
} else if (isDependent) {
- // We cannot look into a dependent object type or
+ // We cannot look into a dependent object type or nested nme
+ // specifier.
return;
} else {
// Perform unqualified name lookup in the current scope.
@@ -205,7 +206,7 @@
assert(!Found.isAmbiguous() &&
"Cannot handle template name-lookup ambiguities");
- if (Found.empty()) {
+ if (Found.empty() && !isDependent) {
// If we did not find any names, attempt to correct any typos.
DeclarationName Name = Found.getLookupName();
if (CorrectTypo(Found, S, &SS, LookupCtx)) {
Added: cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp?rev=93240&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp (added)
+++ cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp Tue Jan 12 11:06:20 2010
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T>
+struct Base {
+ T inner;
+};
+
+template<typename T>
+struct X {
+ template<typename U>
+ struct Inner {
+ };
+
+ bool f(T other) {
+ return this->inner < other;
+ }
+};
Propchange: cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/SemaTemplate/typo-dependent-name.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list