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

            Bug ID: 99103
           Summary: Initializer-list constructors in CTAD for vector is
                    still wrong
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oleksandr.koval.dev at gmail dot com
  Target Milestone: ---

According to P0702R1, initializer-list constructors for T should be ignored
during CTAD if list contains a single element of cv U when U is a
specialization or a child of T. It works for simple things like:

std::vector v{std::vector{1, 2, 3}};
static_assert(std::is_same_v<decltype(v), std::vector<int>>); // fine

But not for this one:

template<typename... Args>
auto make_vector(const Args&... elems){
    return std::vector{elems...};
}
auto v2 = make_vector(std::vector{1,2,3});
static_assert(std::is_same_v<decltype(v2), std::vector<int>>); // fails
static_assert(std::is_same_v<decltype(v2), std::vector<std::vector<int>>>); //
OK

Reply via email to