This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66421] G++ fails compilation when assigning tuple created with variadic template to auto variable
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 05 Jun 2015 11:53:39 +0000
- Subject: [Bug c++/66421] G++ fails compilation when assigning tuple created with variadic template to auto variable
- Auto-submitted: auto-generated
- References: <bug-66421-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66421
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Version|unknown |4.9.2
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:
template<typename... T> struct tuple { };
template<typename... T> tuple<T...> make_tuple(T&&...) { return {}; }
template <typename... Params>
void foo(Params... params) {
auto t = make_tuple((int)params...);
}
template <typename... Params>
void bar(Params... params) {
tuple<decltype((int)params)...> t = make_tuple((int)params...);
}
int main() {
foo(1,2,3); // Fails, clang++ compiles it
bar(1,2,3); // Compiles correctly
}
t.cc: In instantiation of âvoid foo(Params ...) [with Params = {int, int,
int}]â:
t.cc:16:14: required from here
t.cc:7:39: error: conversion from âtuple<int, int, int>â to non-scalar type
âtuple<int>â requested
auto t = make_tuple((int)params...);
^