https://bugs.llvm.org/show_bug.cgi?id=47451

            Bug ID: 47451
           Summary: struct initialization fails in recursive case
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

template<std::size_t INDEX, typename... Ts>
struct A;

template<std::size_t INDEX, typename T>
struct A<INDEX, T> {
    T t;
    // problem "resolves" if we add this ctor
    // template<typename U>
    // A(U&& u): t{u} {}
};

template<std::size_t INDEX, typename T, typename... Ts>
struct A<INDEX, T, Ts...>: A<INDEX+1, Ts...>, A<INDEX, T> {
    template<typename U, typename... Us>
    A(U&& u, Us&&... us): A<INDEX+1, Ts...>(std::forward<Us>(us)...), A<INDEX,
T>{std::forward<U>(u)} {}
};

int main() {
    A<0,int> a1{3}; // ok
    A<0,int,int> a2{3, 3}; // fails
}

// code in compiler explorer: https://godbolt.org/z/K8afeK

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to