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

            Bug ID: 47452
           Summary: compiler crashes without proper diagnostics upon bad
                    recursive variadic template usage
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: kirsha...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

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

template<std::size_t INDEX, typename T>
class A<INDEX, T> {
    T t;
public:
    template<typename U, typename = std::enable_if_t<std::is_constructible_v<T,
U>>>
    constexpr A(U&& u)
    : t{std::forward<U>(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>
    constexpr A(U&& u, Us&&... us) noexcept(noexcept(A<INDEX+1, T,
Ts...>{std::forward<U>(u), std::forward<Us>(us)...}))
    : A<INDEX+1, Ts...>{std::forward<Us>(us)...}, A<INDEX,
T>{std::forward<U>(u)} {}
};

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

---------

The noexcept expression on the ctor of struct A<INDEX, T, Ts...> is recursively
using the same method.

Compiler crashes without proper diagnostics.

Code: https://godbolt.org/z/KcbT13

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

Reply via email to