[llvm-bugs] [Bug 47451] New: struct initialization fails in recursive case
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 7 11:23:03 PDT 2020
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: 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>
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200907/15f1f05b/attachment.html>
More information about the llvm-bugs
mailing list