This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66421] G++ fails compilation when assigning tuple created with variadic template to auto variable


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...);
                                        ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]