Std::visit compiles down to trap instruction when using -expt-relaxed-constexpr


I was tinkering with godbolt, whether I can use the std library implementation of variant and visit on the device. I do not know what the backend host compiler / std library on the godbolt is, but it compiles down to trap instruction and does not produce an error.

Here is the reproducing example (Compiler Explorer Full Link)

Workarounds are also on the link above. You can either use CCCL’s visit/variant or roll your own simple visit implementation.

I do not know how to bug report or whether I should. So I am writing here. At least this should produce an error; detecting such an error would be a hassle.

Edit: Changed the short link to full link since I do not know the duration.