<div dir="ltr"><div>Hi Guys,</div><div>I've noticed that the ASTImporter fails to import some named decls from <iostream> due to an invalid linkagecache (in TagDecl::setTypedefNameForAnonDecl()).</div><div>Running with assertions disabled never terminates.</div><div>However, while trying to build an minimal reproducible example, i stumbled on a different error regarding templated structs with frienddecls.</div><div>I think they may be related because i found this commit: </div><div><a href="https://mailtrack.io/trace/link/3bfa5f729eac3d7d441cda522b04d9aa06778eec?url=https%3A%2F%2Fpublic.cdl.uni-saarland.de%2Fnoise%2Fclang%2Fcommit%2Fad0e27b18b0cefab049121d4bfd7b12216e7de6e&signature=1e3968956e628307">https://public.cdl.uni-saarland.de/noise/clang/commit/ad0e27b18b0cefab049121d4bfd7b12216e7de6e</a></div><div><br></div><div><br></div><div>The following test fails:</div><div> </div><div>> // svn: E155007</div><div>> // unittests/AST/ASTImporterTest.cpp</div><div><div>> TEST(ImportExpr, TemplatedStructFriend) {</div><div>>  MatchVerifier<Decl> Verifier;</div><div>>  EXPECT_TRUE(testImport(</div><div>>  "void foo() {}; \n"</div><div>>  "inline namespace D {\n"</div><div>>  "  template<class>\n"</div><div>>  "  struct declToImport {\n"</div><div>>  "    friend bool f(const declToImport &);\n"</div><div>>  "  };\n"</div><div>>  "  template class declToImport<int>;\n"</div><div>>  "}\n", Lang_CXX, "", Lang_CXX, Verifier, decl()));</div><div>> }</div><div><br></div><div>stacktrace: </div>> clang/llvm/tools/clang/lib/AST/DeclFriend.cpp, line 43.<div>> 0  ASTTests                 0x0000000104f8e135 l </div><div>> lvm::sys::PrintStackTrace(llvm::raw_ostream&) + 101</div><div>> 1  ASTTests                 0x0000000104f8e779 PrintStackTraceSignalHandler(void*) + 25</div><div>> 2  ASTTests                 0x0000000104f8a6d9 llvm::sys::RunSignalHandlers() + 425</div><div>> 3  ASTTests                 0x0000000104f8ec92 SignalHandler(int) + 354</div><div>> 4  libsystem_platform.dylib 0x00007fff9e3eebba _sigtramp + 26</div><div><br></div><div>Thanks in advance,</div><div>Gaetano Checinski</div><div><br></div><div><br></div></div><img width="0" height="0" class="mailtrack-img" src="https://mailtrack.io/trace/mail/fee6e7d23df36d01e1e0d9ea58dee94e09e2ec95.png?u=931501"></div>