It would mean that the instantiation of the class template gained a field which should be impossible.<br><br>On Thursday, June 9, 2016, Kim Gräsman <<a href="mailto:kim.grasman@gmail.com">kim.grasman@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Jun 9, 2016 at 7:26 AM, David Majnemer via cfe-commits<br>
<<a href="javascript:;" onclick="_e(event, 'cvml', 'cfe-commits@lists.llvm.org')">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: majnemer<br>
> Date: Thu Jun 9 00:26:56 2016<br>
> New Revision: 272247<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=272247&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=272247&view=rev</a><br>
> Log:<br>
> [Sema] Don't crash when a field w/ a mem-initializer clashes with a record name<br>
><br>
> It is possible for a field and a class to have the same name. In such<br>
> cases, performing lookup for the field might return a result set with<br>
> more than one entry. An overzealous assertion fired, causing us to<br>
> crash instead of using the non-class lookup result.<br>
><br>
> This fixes PR28060.<br>
><br>
> Modified:<br>
> cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp<br>
> cfe/trunk/test/SemaCXX/member-init.cpp<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=272247&r1=272246&r2=272247&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=272247&r1=272246&r2=272247&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu Jun 9 00:26:56 2016<br>
> @@ -2637,8 +2637,7 @@ Sema::InstantiateClassMembers(SourceLoca<br>
> Instantiation->getTemplateInstantiationPattern();<br>
> DeclContext::lookup_result Lookup =<br>
> ClassPattern->lookup(Field->getDeclName());<br>
> - assert(Lookup.size() == 1);<br>
> - FieldDecl *Pattern = cast<FieldDecl>(Lookup[0]);<br>
> + FieldDecl *Pattern = cast<FieldDecl>(Lookup.front());<br>
> InstantiateInClassInitializer(PointOfInstantiation, Field, Pattern,<br>
> TemplateArgs);<br>
> }<br>
<br>
Now what if there is no match? Or is that guaranteed (given the prior assert)?<br>
<br>
- Kim<br>
</blockquote>