Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

std::variant<std::string> not working with -std=c++20 in TRUNK Clang of GodBolt #51543

Open Quuxplusone opened 2 years ago

Quuxplusone commented 2 years ago
Bugzilla Link PR52576
Status NEW
Importance P release blocker
Reported by Artyom Polkovnikov (artyom.polkovnikov@gmail.com)
Reported on 2021-11-21 23:28:02 -0800
Last modified on 2021-11-21 23:28:02 -0800
Version trunk
Hardware PC Windows NT
CC blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments errors.txt (4417 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 25465
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.
Quuxplusone commented 2 years ago

Attached errors.txt (4417 bytes, text/plain): Errors log