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++/43261] New: name depends on Variadic Template Parameter is looked up at the point of definition


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


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