public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11872] New: missing template instantiation getting pointer to static members in inline member
@ 2003-08-10  2:56 monge at sns dot it
  2003-08-10  3:00 ` [Bug c++/11872] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: monge at sns dot it @ 2003-08-10  2:56 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11872

           Summary: missing template instantiation getting pointer to static
                    members in inline member
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: monge at sns dot it
                CC: gcc-bugs at gcc dot gnu dot org

The following code fails to compile with linker error: 
 
//********************************************************** 
//tmpl.cpp 
//********************************************************** 
 
typedef void(*funx)(); 
 
template<class T> class ciao 
{ 
public: 
        static void foo(){printf("ciao\n");} 
        void member() { funx f = foo; } 
}; 
 
int main() 
{ 
        ciao<int> c; 
	c.member(); 
        return 0; 
} 
 
//********************************************************** 
I get  
/tmp/ccaEJicr.o(.gnu.linkonce.t._ZN4ciaoIiE6memberEv+0x9): In function 
`ciao<int>::member()': 
: undefined reference to `ciao<int>::foo()' 
 
in facts: 
>g++ tmpl.cpp -c; nm -C tmpl.o 
                U ciao<int>::foo() 
00000000 W ciao<int>::member() 
00000000 T main 
 
if i replace  
        void member() { funx f = foo; } 
with 
        void member() { foo(); } 
or 
        void member() { funx f = ciao::foo; } 
or 
        void member() { funx f = ciao<int>::foo; } 
(but not ciao<float>) 
 
it works ok. 
all work ok with g++ 2.95 and 3.2. 
 
 
my config is: 
 
Linux 2.4.20 (debian unstable) 
libc 2.3.1 
 
gcc: 
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs 
Configured with: ./configure --with-gnu-as --with-gnu-ld --program-suffix=-3.4 
--enable-languages=c,c++ --prefix=/usr 
Thread model: posix 
gcc version 3.4 20030723 (experimental)


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

* [Bug c++/11872] missing template instantiation getting pointer to static members in inline member
  2003-08-10  2:56 [Bug c++/11872] New: missing template instantiation getting pointer to static members in inline member monge at sns dot it
@ 2003-08-10  3:00 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-10  3:00 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11872


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-10 03:00 -------
This is a dup of bug 10804 which is already fixed in 20030809.

*** This bug has been marked as a duplicate of 10804 ***


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

end of thread, other threads:[~2003-08-10  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-10  2:56 [Bug c++/11872] New: missing template instantiation getting pointer to static members in inline member monge at sns dot it
2003-08-10  3:00 ` [Bug c++/11872] " pinskia 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).