https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116381

            Bug ID: 116381
           Summary: std::variant should not allow array type as an
                    alternative
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m at tryfinally dot com
  Target Milestone: ---

Created attachment 58930
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58930&action=edit
minimal code which should not compile but does

std::variant requires all alternative types to be Cpp17Destructible. See 
https://eel.is/c++draft/variant#variant.general-2

arrays are not Cpp17Destructible.
https://eel.is/c++draft/utility.arg.requirements#:Cpp17Destructible

#include <variant>

std::variant<int[3]> v; // should fail to compile

godbolt: https://godbolt.org/z/PvTja54PE

this behavior goes back to GCC 7.1

Reply via email to