[Bug c++/34213] New: static member function in anonymous namespace can't be used as template argument
tim at klingt dot org
gcc-bugzilla@gcc.gnu.org
Sat Nov 24 11:42:00 GMT 2007
trying to use member functions of classes in the anonymous namespace as
template argument doesn't work.
the following code illustrates this issue:
template <void (*fn)(void)>
void call(void)
{
fn();
}
namespace
{
struct bar
{
static void fn(void) {}
};
}
int main()
{
call<&bar::fn>();
}
it complains:
error: âÂÂ<unnamed>::bar::fnâ is not a valid template argument for type
âÂÂvoid (*)()â because function âÂÂstatic void<unnamed>::bar::fn()â has not
external linkage
gcc -v:
tim@laptop:~$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)
would be great to have this fixed ...
--
Summary: static member function in anonymous namespace can't be
used as template argument
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tim at klingt dot org
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34213
More information about the Gcc-bugs
mailing list