[cfe-dev] ASTImporter triggers assertions in some cases.

Gaetano Checinski via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 9 05:49:56 PST 2017


Hi Guys,
I've noticed that the ASTImporter fails to import some named decls from
<iostream> due to an invalid linkagecache
(in TagDecl::setTypedefNameForAnonDecl()).
Running with assertions disabled never terminates.
However, while trying to build an minimal reproducible example, i stumbled
on a different error regarding templated structs with frienddecls.
I think they may be related because i found this commit:
https://public.cdl.uni-saarland.de/noise/clang/commit/ad0e27b18b0cefab049121d4bfd7b12216e7de6e
<https://mailtrack.io/trace/link/3bfa5f729eac3d7d441cda522b04d9aa06778eec?url=https%3A%2F%2Fpublic.cdl.uni-saarland.de%2Fnoise%2Fclang%2Fcommit%2Fad0e27b18b0cefab049121d4bfd7b12216e7de6e&signature=1e3968956e628307>


The following test fails:

> // svn: E155007
> // unittests/AST/ASTImporterTest.cpp
> TEST(ImportExpr, TemplatedStructFriend) {
>  MatchVerifier<Decl> Verifier;
>  EXPECT_TRUE(testImport(
>  "void foo() {}; \n"
>  "inline namespace D {\n"
>  "  template<class>\n"
>  "  struct declToImport {\n"
>  "    friend bool f(const declToImport &);\n"
>  "  };\n"
>  "  template class declToImport<int>;\n"
>  "}\n", Lang_CXX, "", Lang_CXX, Verifier, decl()));
> }

stacktrace:
> clang/llvm/tools/clang/lib/AST/DeclFriend.cpp, line 43.
> 0  ASTTests                 0x0000000104f8e135 l
> lvm::sys::PrintStackTrace(llvm::raw_ostream&) + 101
> 1  ASTTests                 0x0000000104f8e779
PrintStackTraceSignalHandler(void*) + 25
> 2  ASTTests                 0x0000000104f8a6d9
llvm::sys::RunSignalHandlers() + 425
> 3  ASTTests                 0x0000000104f8ec92 SignalHandler(int) + 354
> 4  libsystem_platform.dylib 0x00007fff9e3eebba _sigtramp + 26

Thanks in advance,
Gaetano Checinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170109/990ca3cf/attachment.html>


More information about the cfe-dev mailing list