https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69743

            Bug ID: 69743
           Summary: function overload - template instantiation depth
                    exceeds maximum (gcc4, clang - no problem)
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Konstantin.Sadov at gmail dot com
  Target Milestone: ---

The following code

[code]
template <typename D, typename... T>
void f(int, T... d)
{
}

template <typename D, typename... T>
void f(T... d)
{
  f<D>(1, d...);
}

void g(void)
{
  f<long>(1.0);
}
[code]

produces error

[error]
In instantiation of ‘void f(T ...) [with D = long int; T = {int, lots of int,
int, double}]’:
recursively required from ‘void f(T ...) [with D = long int; T = {int,
double}]’
required from ‘void f(T ...) [with D = long int; T = {double}]’
required from here
fatal error: template instantiation depth exceeds maximum of 900 (use
-ftemplate-depth= to increase the maximum)
[error]

gcc 4.4, gcc 4.7, clang 3.7 compiles the code without problems.

Reply via email to