[Bug c++/10950] New: multiple template function definitions

collar@gamic.com gcc-bugzilla@gcc.gnu.org
Fri May 23 12:01:00 GMT 2003


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

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

           Summary: multiple template function definitions
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: collar@gamic.com
                CC: gcc-bugs@gcc.gnu.org

Greetings,

I'm having a problem with gcc 3.3 that doesn't occur with gcc 3.2. The problem
relates to template functions and template specializations. If I specialize a
template function in a header file, include and use these functions in two
different implementation files, then link them all together in one library, I
get the following error from gcc 3.3:

i.o: In function `DataValidPolicy<int>::thValue()':
i.o(.text+0x0): multiple definition of `DataValidPolicy<int>::thValue()'
h.o(.text+0x0): first defined here
i.o: In function `DataValidPolicy<int>::notScanValue()':
i.o(.text+0xa): multiple definition of `DataValidPolicy<int>::notScanValue()'
h.o(.text+0xa): first defined here

I do not receive such errors from gcc3.2, gcc2.95, or Intel's icc 7 compiler.

Output from gcc3.3 -v:
Configured with: ../gcc-3.2.2/configure --prefix=/usr/local --program-suffix=3.3
--enable-langs=c,c++,java --enable-beohm --disable-nls --enable-threads :
(reconfigured) ../gcc-3.2.2/configure --prefix=/usr/local --program-suffix=3.3
--enable-langs=c,c++,java --enable-beohm --disable-nls --enable-threads :
(reconfigured) ../gcc-3.2.2/configure --prefix=/usr/local --program-suffix=3.3
--enable-langs=c,c++,java --enable-beohm --disable-nls --enable-threads
Thread model: posix
gcc version 3.3

Output from gcc3.2 -v:
Reading specs from /usr/local/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs
Configured with: ../gcc-3.2.2/configure --prefix=/usr/local/
--program-suffix=3.2 --enable-langs=c,c++,java --enable-beohm --disable-nls
--enable-threads : (reconfigured) ../gcc-3.2.2/configure --prefix=/usr/local/
--program-suffix=3.2 --enable-langs=c,c++,java --enable-beohm --disable-nls
--enable-threads
Thread model: posix
gcc version 3.2.3

I will include a testcase after I commit this entry. If you change $(CXX) to be
gcc3.2, all is well. But if $(CXX) is gcc3.3, all is broken.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Gcc-bugs mailing list