Explicit instantiation of empty template parameter packs
Sam Varshavchik
mrsam@courier-mta.com
Fri Jan 27 16:27:00 GMT 2012
Given the following template, with gcc 4.6 and -std=c++0x:
=============================================================================
template<typename... Args>
void foo(Args... args)
{
}
=============================================================================
Both "foo();" and "foo(4);" compiles, as expected. If I want to explicitly
instantiate both template signatures:
template void foo(int);
This goes through. But this does not:
template void foo();
gcc 4.6 rejects this:
/tmp/t.C:16:15: error: template-id ‘foo<>’ for ‘void foo()’ does not match
any template declaration
How do I tell gcc to explicitly instantiate template with an empty parameter
pack. It'll obviously instantiate it implicitly, since "foo();" gets
compiled, as expected.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20120127/149e2831/attachment.sig>
More information about the Gcc-help
mailing list