The non-inline specialization of an inline member function of a template class 
is not being treated as 
inline when using precompiled headers.

For example, consider

  test.H:
    template <class T> class simple_class {
      public:
        inline void testfn (T);
    };

  test.C:
    #include "test.H"

    template <> void simple_class<int>::testfn (int) {}

    int main (int argc, char *argv[])
    {
      simple_class<int> sc1;
      sc1.testfn (5);
    }

When compiled without precompiled headers, the function appears a simple global 
function:

        .global _ZN12simple_classIiE6testfnEi

But when test.H is first compiled (with "g++ test.H") into a PCH, and then 
test.C is compiled, the 
function appears as a weak symbol in a COMDAT section, implying that g++ is 
considering the 
specialization "inline" even though it isn't marked as such.

        .section        .text._ZN12simple_classIiE6testfnEi,"axG",%
progbits,_ZN12simple_classIiE6testfnEi,comdat
        .align  2
        .weak   _ZN12simple_classIiE6testfnEi
        .type   _ZN12simple_classIiE6testfnEi, %function

-- 
           Summary: Non-inline function incorrectly treated as inline when
                    using precompiled headers
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jconner at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: arm-none-elf


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

Reply via email to