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

            Bug ID: 92156
           Summary: Cannot in-place construct std::any with std::any
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jason.e.cobb at gmail dot com
  Target Milestone: ---

GCC (and clang, when using libstdc++) claim that the following program is
ill-formed when compiled with "-std=c++17":

#include <any>

int main() {
    auto a = std::any(std::in_place_type<std::any>, 5);
}

[end code]

Both clang with libc++ and MSVC accept this program.

On Compiler Explorer: https://godbolt.org/z/ckzMsg .

The standard says that this is correct. Under
http://eel.is/c++draft/any.cons#itemdecl:5 , the only requirements are that T
be copy-constructible and constructible from the in-place args. std::any is
copy-constructible and constructible from int, so this program should be
well-formed.

Reply via email to