<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Assertion failure when exporting class containing defaulted operator<=> defined as friend"
   href="https://bugs.llvm.org/show_bug.cgi?id=44992">44992</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure when exporting class containing defaulted operator<=> defined as friend
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++2a
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david@doublewise.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
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>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
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
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> 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: 

********************
```</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>