Generating an object file with "g++ -c test.cc" for the following code snippet:

----------
template <int> void f() {}
int g() { f<1> (); }
template void f<1> ();
----------

"nm -gm test.o" returns:

000000ac (__TEXT,__eh_frame) weak private external _Z1fILi1EEvv.eh
00000084 (__TEXT,__eh_frame) external _Z1gv.eh
00000050 (__TEXT,__textcoal_nt) weak private external __Z1fILi1EEvv
00000000 (__TEXT,__text) external __Z1gv
        (undefined) external ___gxx_personality_v0
        (undefined) external dyld_stub_binding_helper


while the same procedure for:
------------------
template <int> void f() {}
template void f<1> ();
int g() { f<1> (); }
------------------

results in:

00000000 (absolute) external [no dead strip] _Z1fILi1EEvv.eh
00000000 (absolute) external [no dead strip] _Z1gv.eh
00000000 (__TEXT,__text) external __Z1fILi1EEvv
00000018 (__TEXT,__text) external __Z1gv

This error could lead to problems in conjunction with the creation of dynamic
libraries.


-- 
           Summary: The symbol properties of generated C++ code depend on
                    the position of template instantiations
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P4
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: O dot Kayser-Herold at tu-bs dot de
 GCC build triplet: 20030304 (Apple Computer, Inc. build 1666)
  GCC host triplet: powerpc-apple-darwin7.9.0


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

Reply via email to