summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-06-09 05:26:56 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-06-09 05:26:56 +0000
commit9b3527b069830d903a8fad7f93d76eb461d9f414 (patch)
treea5a27c59943c637795697a34855fd1b2522d83c2 /lib/Sema/SemaTemplateInstantiate.cpp
parent2e5ffa9f6bde60beebf1c597912adb48cf9a58c6 (diff)
[Sema] Don't crash when a field w/ a mem-initializer clashes with a record name
It is possible for a field and a class to have the same name. In such cases, performing lookup for the field might return a result set with more than one entry. An overzealous assertion fired, causing us to crash instead of using the non-class lookup result. This fixes PR28060. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 554d1abbed..24a47d1942 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2637,8 +2637,7 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation,
Instantiation->getTemplateInstantiationPattern();
DeclContext::lookup_result Lookup =
ClassPattern->lookup(Field->getDeclName());
- assert(Lookup.size() == 1);
- FieldDecl *Pattern = cast<FieldDecl>(Lookup[0]);
+ FieldDecl *Pattern = cast<FieldDecl>(Lookup.front());
InstantiateInClassInitializer(PointOfInstantiation, Field, Pattern,
TemplateArgs);
}