http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59914

            Bug ID: 59914
           Summary: A variadic function template that forwards to a
                    multi-pack variadic template causes an infinite loop
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com

template <class T, class... U> void f(T&& t, int i, U&&... u) {} 
template <class... T> void g(T&&... t) {g(t..., 5, t...);} 
int main() {g(6, 6, 6);}

Now, this was just a typo - the invocation in g was supposed to invoke f.
The compiler goes nuts and pegs the cpu. This is certainly undefined
behavior, but I wonder if it's possible to do something a bit more graceful.

Reply via email to