IBM Support

LI73499: TEMPLATE UNDEFINED SYMBOL

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following template testcase can't link with error message of
    undefined symbol.
    
    The class template member function takes a function
    with typedef'd parameter.
    
    
    ===== TESTCASE:
    
    $ cat t.cpp
    template <class T>
    struct A
    {
        typedef T U;
        void apply(void f(const U&)) const;
    };
    
    template <class T>
    void A<T>::apply(void f(const U&)) const { }
    
    struct S { };
    void bar (const S&) { };
    
    int main ()
    {
      A<S>().apply(bar);
      return 0;
    }
    
    
    $ xlC t.cpp
    ld: 0711-317 ERROR: Undefined symbol: .A<S>::apply(void(*)(const
    S&)) const
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain
    more information.
    

Local fix

  • N/A
    

Problem summary

  • The problem appears when a typedef is used in a pointer to
    function argument of a template function.
    

Problem conclusion

  • The compiler did not correctly instantiate the function causing
    a link error. Compiler code has been corrected to resolve the
    problem.
    

Temporary fix

  • Avoid using the typedef.
    

Comments

APAR Information

  • APAR number

    LI73499

  • Reported component name

    XL C/C++ AE BG/

  • Reported component ID

    5799HJH00

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2008-06-20

  • Closed date

    2008-06-20

  • Last modified date

    2008-06-20

  • APAR is sysrouted FROM one or more of the following:

    IZ10672

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ AE BG/

  • Fixed component ID

    5799HJH00

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
15 October 2021