public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34213]  New: static member function in anonymous namespace can't be used as template argument
@ 2007-11-24 11:42 tim at klingt dot org
  2007-11-24 11:42 ` [Bug c++/34213] " tim at klingt dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tim at klingt dot org @ 2007-11-24 11:42 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-03-31  1:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-24 11:42 [Bug c++/34213] New: static member function in anonymous namespace can't be used as template argument tim at klingt dot org
2007-11-24 11:42 ` [Bug c++/34213] " tim at klingt dot org
2007-11-25  3:06 ` [Bug c++/34213] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2007-11-26 12:45 ` jakub at gcc dot gnu dot org
2007-11-27  7:12 ` jakub at gcc dot gnu dot org
2007-11-27  7:13 ` [Bug c++/34213] [4.2 " jakub at gcc dot gnu dot org
2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org
2008-05-19 20:33 ` jsm28 at gcc dot gnu dot org
2009-03-31  1:36 ` jsm28 at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).