[llvm-bugs] [Bug 47452] New: compiler crashes without proper diagnostics upon bad recursive variadic template usage
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 7 11:44:16 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: kirshamir at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200907/3c70a66b/attachment.html>
More information about the llvm-bugs
mailing list