[llvm-bugs] [Bug 47590] New: Clang crashes when std::visit is called with a lambda with trailing return type that requires messy name lookup

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 20 12:00:44 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47590

            Bug ID: 47590
           Summary: Clang crashes when std::visit  is called with a lambda
                    with trailing return type that requires messy name
                    lookup
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rileylevy95 at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 23986
  --> https://bugs.llvm.org/attachment.cgi?id=23986&action=edit
The repro.cpp file, the repro.ii file, and clang's stderr output pasted into
one file, separated by headers with ==============s

Suppose you have a few types with a free function defined on each of them. You
might want to define an overload that accepts a std::variant of these types and
calls std::visit to choose the appropriate behavior at runtime, perhaps using a
LIFT macro to pass the whole overload set to std::visit. 

But the name lookup in the trailing type ->decltype(the_function(...)) crashes
clang sometimes. 

I'm attaching an example where this happened. 

I'm running clang 10 on Linux as installed by my package manager, but the same
problem occurred on godbolt using trunk: https://godbolt.org/z/xa7oEY

I ran it with  
$ clang++ -std=c++20 repro.cpp

-- 
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/20200920/9662d208/attachment.html>


More information about the llvm-bugs mailing list