Using the below code snipped (bug.C), and compiling it using:

  gcc -Wall -O2 -save-temps -c -o bug.o bug.C

causes _ZN1B1fIiEEvPT_ to disappear from the .s-file, and later on breaking the
link. Using -O1 works fine.

---- bug.C ----

struct B {
    template <class T> void f(T * t);
    void dummyInst();
};

template <class T> void
B::f(T * t)
{
}

void
B::dummyInst() {
    f((int*)0);
}


-- 
           Summary: templated member func vanish from assembler code when -
                    O2 is used
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jaeschke at de dot ibm dot com
 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=42340

Reply via email to