diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-06-09 05:26:56 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-09 05:26:56 +0000 |
commit | 76a256260ed066d02b548c768d3c175f4902f484 (patch) | |
tree | 1a1f5469a06fe39a43557bd4942c27771dcdd509 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 2769bb5753618eabe700b223212c304aefc70d34 (diff) | |
download | bcm5719-llvm-76a256260ed066d02b548c768d3c175f4902f484.tar.gz bcm5719-llvm-76a256260ed066d02b548c768d3c175f4902f484.zip |
[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.
llvm-svn: 272247
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 554d1abbed1..24a47d19421 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/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); } |