[Bug c++/56760] namespaces, templates and forwarding declarations.

erik.thiele@thiele-hydraulik.de gcc-bugzilla@gcc.gnu.org
Thu Mar 28 07:05:00 GMT 2013


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

--- Comment #2 from erik.thiele@thiele-hydraulik.de 2013-03-28 07:05:22 UTC ---
You see attached two files. v1.cpp and v2.cpp

g++ --version
g++ (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ -Wall v1.cpp
/tmp/ccZAyNEb.o: In function `void func<seco::holder<int>
>(seco::contain<seco::holder<int> > const&, nam::binbuffer&)':
v1.cpp:(.text._Z4funcIN4seco6holderIiEEEvRKNS0_7containIT_EERN3nam9binbufferE[_Z4funcIN4seco6holderIiEEEvRKNS0_7containIT_EERN3nam9binbufferE]+0x16):
undefined reference to `void func<seco::holder<int> >(seco::holder<int> const&,
nam::binbuffer&)'
collect2: error: ld returned 1 exit status

g++ -Wall v2.cpp
--> no errors

in v1.cpp you see a commented out line with a template forward declaration. if
you comment that in:

g++ -Wall v1.cpp
--> no errors

The only difference between v1 and v2 is that in v2 you do not have the "nam"
namespace.



More information about the Gcc-bugs mailing list