Dependant name shall be look up at the point of instantiation.
But for names that depends on Variadic Template Parameter, are looked up at the
point of definition.

Following code is well-formed. and shall be compiled.

template < typename T, typename ... Args >
void f(T, Args... rest)
{// point of defination
    f(rest...) ;
}

template < typename T>
void f(T)
{ /* Terminate the recursion. */}

int main()
{
    // point of instantiation.
    f(0,0,0,0) ;
}

But compiler said error: no matching function for call to 'f()'

If I change the declaration order:

// just flip the order.
template < typename T>
void f(T)
{ /* Terminate the recursion. */}

template < typename T, typename ... Args >
void f(T, Args... rest)
{// point of definition
    f(rest...) ;
}

int main()
{
    f(0,0,0,0) ;
}


It works.

So the name depends on Variadic Tamplate Parameter is somehow looked up at the
point of definition where it shall be at the point of instantiation.


-- 
           Summary: name depends on Variadic Template Parameter is looked up
                    at the point of definition
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: boostcpp at gmail dot com


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

Reply via email to