This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/43261] New: name depends on Variadic Template Parameter is looked up at the point of definition
- From: "boostcpp at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Mar 2010 20:21:48 -0000
- Subject: [Bug c++/43261] New: name depends on Variadic Template Parameter is looked up at the point of definition
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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