<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 26, 2015 at 4:15 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Just FYI in case others see this:</div><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Wed, Mar 25, 2015 at 8:11 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="overflow:hidden">+ assert(ConstructorNameSet.empty() && "Failed to find all of the visible "<br>
+ "constructors by walking all the "<br>
+ "lexical members of the context.");</div></blockquote></div><br></span>I've got at least one case where this assert trips. It seems really obscure and only the modules selfhost bot has seen it so I've not reverted, but if this is causing anyone trouble, feel free.</div><div class="gmail_extra"><br>I've got it reproduced technically, but still digging into exactly what the right fix will be. The case looks like:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">(gdb) p ConstructorNameSet.Vector.size()</div><div class="gmail_extra">$1 = 1</div><div class="gmail_extra">(gdb) p DC->dumpLookups()</div><div class="gmail_extra">StoredDeclsMap CXXRecord 0x7fffca58e458 ''</div><div class="gmail_extra">|-DeclarationName '__count'</div><div class="gmail_extra">| `-Field 0x7fffc47da8a0 '__count' 'int'</div><div class="gmail_extra">|-DeclarationName ''</div><div class="gmail_extra">| |-CXXConstructor 0x7fffca58e8b0 '' 'void (void) noexcept'</div><div class="gmail_extra">| |-CXXConstructor 0x7fffca58e998 '' 'void (const __mbstate_t &)'</div><div class="gmail_extra">| `-CXXConstructor 0x7fffca58eb88 '' 'void (__mbstate_t &&) noexcept'</div><div class="gmail_extra">|-DeclarationName '__value'</div><div class="gmail_extra">| `-Field 0x7fffc47da900 '__value' 'union (anonymous union at /usr/include/wchar.h:85:3)':'union __mbstate_t::(anonymous at /usr/include/wchar.h:85:3)'</div><div class="gmail_extra">|-DeclarationName '~'</div><div class="gmail_extra">| `-CXXDestructor 0x7fffc47da7b0 '~' 'void (void)'</div><div class="gmail_extra">`-<undeserialized lookups></div><div class="gmail_extra">$2 = void</div><div class="gmail_extra">(gdb) p clang::Decl::castFromDeclContext(DC)->dump()</div><div class="gmail_extra">CXXRecordDecl 0x7fffca58e458 </usr/include/wchar.h:82:9, line:94:1> line:82:9 in __usr_include.wchar struct definition</div><div class="gmail_extra">|-CXXRecordDecl 0x7fffc47da950 <line:85:3, line:93:3> line:85:3 in __usr_include.wchar union definition</div><div class="gmail_extra">| |-FieldDecl 0x7fffc47db788 <<built-in>:104:23, /usr/include/wchar.h:88:19> col:19 in __usr_include.wchar __wch 'unsigned int'</div><div class="gmail_extra">| `-FieldDecl 0x7fffc47db7e8 <line:92:5, col:18> col:10 in __usr_include.wchar __wchb 'char [4]'</div><div class="gmail_extra">|-FieldDecl 0x7fffc47da8a0 <line:84:3, col:7> col:7 in __usr_include.wchar referenced __count 'int'</div><div class="gmail_extra">|-FieldDecl 0x7fffc47da900 <line:85:3, line:93:5> col:5 in __usr_include.wchar referenced __value 'union (anonymous union at /usr/include/wchar.h:85:3)':'union __mbstate_t::(anonymous at /usr/include/wchar.h:85:3)'</div><div class="gmail_extra">`-CXXDestructorDecl 0x7fffc47da7b0 <line:82:9> col:9 implicit ~ 'void (void)' inline noexcept-unevaluated 0x7fffc47da7b0</div><div class="gmail_extra">$3 = void</div><div><br></div><div><br></div><div>And the type in question is roughly:</div><div><br></div><div>typedef struct {</div><div> int __count;</div><div> union {</div><div> wint_t __wch;</div><div> char __wchb[4];</div><div> } __value;</div><div>} __mbstate_t;</div><div><br></div><div><br></div><div>So far, naive attempts to produce a more targeted test case have failed.</div></div></div>
</blockquote></div><br></div><div class="gmail_extra">So, the problem seems to be that the class has implicit special members that are not in the list of lexical declarations of the class but are in the visible lookup results. In order for this to happen, you might need to have two definitions of a class that get merged together, where the implicit special members are only present in the definition that we demoted to a declaration.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Perhaps the simplest thing to do would be to add the name of the current class to Names before performing the lexical walk of the class, if it's in the list of constructor names. That would also let you avoid the lexical walk entirely if the only constructor or conversion name is for the class's own constructor(s) (that is, if the class has no inheriting constructors or conversion functions, but does have constructors, which is likely to be a very common case).</div></div>