[llvm-bugs] [Bug 44992] New: Assertion failure when exporting class containing defaulted operator<=> defined as friend
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 21 15:56:50 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44992
Bug ID: 44992
Summary: Assertion failure when exporting class containing
defaulted operator<=> defined as friend
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: david at doublewise.net
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
The following translation unit:
```
module;
#include <compare>
export module a;
export struct s {
friend auto operator<=>(s const &, s const &) = default;
};
```
fails to compile with `clang++ -std=c++2a -stdlib=libc++ -o /dev/null -c
a.cpp`, outputting:
```
clang++: /home/david.stone/code/llvm/clang/lib/AST/DeclBase.cpp:1615:
DeclContext::lookup_result clang::DeclContext::lookup(clang::DeclarationName)
const: Assertion `getDeclKind() != Decl::LinkageSpec && getDeclKind() !=
Decl::Export && "should not perform lookups into transparent contexts"' failed.
Stack dump:
0. Program arguments: clang++ -std=c++2a -stdlib=libc++ -o /dev/null -c
a.cpp
1. a.cpp:9:2: current parser token ';'
2. a.cpp:7:8: parsing struct/union/class body 's'
#0 0x0000000001877bf4 PrintStackTraceSignalHandler(void*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x1877bf4)
#1 0x000000000187578e llvm::sys::RunSignalHandlers()
(/home/david.stone/code/llvm/build/bin/clang-10+0x187578e)
#2 0x0000000001876d82 llvm::sys::CleanupOnSignal(unsigned long)
(/home/david.stone/code/llvm/build/bin/clang-10+0x1876d82)
#3 0x00000000018046c3 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
(/home/david.stone/code/llvm/build/bin/clang-10+0x18046c3)
#4 0x00000000018047fc CrashRecoverySignalHandler(int)
(/home/david.stone/code/llvm/build/bin/clang-10+0x18047fc)
#5 0x00007fe192e848a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
#6 0x00007fe19192df47 raise
/usr/src/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#7 0x00007fe19192f8b1 abort /usr/src/glibc-2.27/stdlib/abort.c:81:0
#8 0x00007fe19191f42a __assert_fail_base
/usr/src/glibc-2.27/assert/assert.c:89:0
#9 0x00007fe19191f4a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
#10 0x0000000003b2b791 clang::DeclContext::lookup(clang::DeclarationName) const
(/home/david.stone/code/llvm/build/bin/clang-10+0x3b2b791)
#11 0x000000000355472b LookupDirect(clang::Sema&, clang::LookupResult&,
clang::DeclContext const*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x355472b)
#12 0x0000000003550907 clang::Sema::LookupQualifiedName(clang::LookupResult&,
clang::DeclContext*, bool)
(/home/david.stone/code/llvm/build/bin/clang-10+0x3550907)
#13 0x0000000003816fed
clang::TemplateDeclInstantiator::VisitFunctionDecl(clang::FunctionDecl*,
clang::TemplateParameterList*, clang::TemplateDeclInstantiator::RewriteKind)
(/home/david.stone/code/llvm/build/bin/clang-10+0x3816fed)
#14 0x000000000381f437
clang::Sema::SubstSpaceshipAsEqualEqual(clang::CXXRecordDecl*,
clang::FunctionDecl*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x381f437)
#15 0x00000000032dbd37
clang::Sema::AddImplicitlyDeclaredMembersToClass(clang::CXXRecordDecl*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x32dbd37)
#16 0x000000000324827a clang::Sema::ActOnFields(clang::Scope*,
clang::SourceLocation, clang::Decl*, llvm::ArrayRef<clang::Decl*>,
clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesView
const&) (/home/david.stone/code/llvm/build/bin/clang-10+0x324827a)
#17 0x00000000032db5cb
clang::Sema::ActOnFinishCXXMemberSpecification(clang::Scope*,
clang::SourceLocation, clang::Decl*, clang::SourceLocation,
clang::SourceLocation, clang::ParsedAttributesView const&)
(/home/david.stone/code/llvm/build/bin/clang-10+0x32db5cb)
#18 0x0000000003044ceb
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/home/david.stone/code/llvm/build/bin/clang-10+0x3044ceb)
#19 0x000000000304278b
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/david.stone/code/llvm/build/bin/clang-10+0x304278b)
#20 0x0000000003023022
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x3023022)
#21 0x000000000300b15a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/david.stone/code/llvm/build/bin/clang-10+0x300b15a)
#22 0x000000000300ae85
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/david.stone/code/llvm/build/bin/clang-10+0x300ae85)
#23 0x0000000003009f50
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x3009f50)
#24 0x000000000303cb10 clang::Parser::ParseExportDeclaration()
(/home/david.stone/code/llvm/build/bin/clang-10+0x303cb10)
#25 0x000000000300964b
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x300964b)
#26 0x0000000003007d46
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/david.stone/code/llvm/build/bin/clang-10+0x3007d46)
#27 0x00000000030030a8 clang::ParseAST(clang::Sema&, bool, bool)
(/home/david.stone/code/llvm/build/bin/clang-10+0x30030a8)
#28 0x000000000203b3f0 clang::FrontendAction::Execute()
(/home/david.stone/code/llvm/build/bin/clang-10+0x203b3f0)
#29 0x0000000001fd1fe4
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/david.stone/code/llvm/build/bin/clang-10+0x1fd1fe4)
#30 0x00000000020ec44f
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/david.stone/code/llvm/build/bin/clang-10+0x20ec44f)
#31 0x00000000008bc6fd cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/david.stone/code/llvm/build/bin/clang-10+0x8bc6fd)
#32 0x00000000008ba75c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/david.stone/code/llvm/build/bin/clang-10+0x8ba75c)
#33 0x0000000001e90242 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long)
(/home/david.stone/code/llvm/build/bin/clang-10+0x1e90242)
#34 0x00000000018045e1
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/david.stone/code/llvm/build/bin/clang-10+0x18045e1)
#35 0x0000000001e8f86d
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/home/david.stone/code/llvm/build/bin/clang-10+0x1e8f86d)
#36 0x0000000001e5e88d
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/david.stone/code/llvm/build/bin/clang-10+0x1e5e88d)
#37 0x0000000001e5ec7d
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/david.stone/code/llvm/build/bin/clang-10+0x1e5ec7d)
#38 0x0000000001e761d8
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/david.stone/code/llvm/build/bin/clang-10+0x1e761d8)
#39 0x00000000008b9f21 main
(/home/david.stone/code/llvm/build/bin/clang-10+0x8b9f21)
#40 0x00007fe191910b97 __libc_start_main
/usr/src/glibc-2.27/csu/../csu/libc-start.c:344:0
#41 0x00000000008b748a _start
(/home/david.stone/code/llvm/build/bin/clang-10+0x8b748a)
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/david.stone/code/llvm/build/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/a-34491e.cpp
clang-10: note: diagnostic msg: /tmp/a-34491e.sh
clang-10: note: diagnostic msg:
********************
```
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200221/a52524b8/attachment-0001.html>
More information about the llvm-bugs
mailing list