[llvm-bugs] [Bug 52576] New: std::variant<std::string> not working with -std=c++20 in TRUNK Clang of GodBolt

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 21 23:28:02 PST 2021


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

            Bug ID: 52576
           Summary: std::variant<std::string> not working with -std=c++20
                    in TRUNK Clang of GodBolt
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: artyom.polkovnikov 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 25465
  --> https://bugs.llvm.org/attachment.cgi?id=25465&action=edit
Errors log

If I compile on godbolt's trunk Clang with option -std=c++20 following code:


#include <variant>
#include <string>

int main() { std::variant<std::string> s = std::string("abc"); }


I get lots of errors:

==================================================

In file included from <source>:1:
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/12.0.0/../../../../include/c++/12.0.0/variant:460:2:
error: attempt to use a deleted function
        _Variant_storage(in_place_index_t<_Np>, _Args&&... __args)
        ^
............... MANY MORE ERRORS HERE .......................

==================================================

but if I compile same code with -std=c++17 or with release 13.0.0 CLang, then
everything compiles and works.

I got this error with -std=c++20 on current TRUNK in GodBolt
https://godbolt.org/z/x4o8GKbTv

while -std=c++17 on TRUNK works https://godbolt.org/z/on9EbeY7z and also
release 13.0.0 works with -std=c++20 https://godbolt.org/z/vGhj7q63z

Attaching full log "errors.txt" of errors in case if godbolt updates TRUNK to
some other working version.

-- 
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/20211122/d5e20641/attachment.html>


More information about the llvm-bugs mailing list