IBM Support

LI76253: EXPLICIT SPECIALIZATION FUNCTION ERROR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When creating an instantiation of a normal template class that
    uses a static member function from a different, explicit
    specialization template class, the compiler is incorrectly
    generating an error.
    
    This incorrect behaviour is demonstrated in the following test
    case, where the explicitly specialized template class's primary
    template class does not have a definition, but the explicit
    specialization does.
    
    This is valid, because the definition of an explicitly
    specialized template class is unrelated to the definition of the
    primary template.  The primary template is not required to be
    defined in order to define the specialization.
    
    
       =====  TEST CASE  =====
    
    template <class T>
    class MyClass
    {
     private:
      static int const value;
    };
    
    template <class T> struct ExpSpec;
    //template<class T> struct ExpSpec { };  // primary template
    // Uncomment the primary definition, and the test case passes
    
    template<> // explicit specialization template
    struct ExpSpec<unsigned int>
    {
      static int getvalue() { return 7; }
    };
    
    template <class T>
    int const MyClass<T>::value = ExpSpec<T>::getvalue();
    
    
    template class MyClass<unsigned int>; // instantiation
    
    
       =====  Compile  =====
    
    $ xlC -c test.cpp
    "test.cpp", line 19.31: 1540-0062 (S) The incomplete class
    "ExpSpec" must not be used as a qualifier.
    $
    

Local fix

  • Add a stub definition for the primary template class.
    

Problem summary

  • PROBLEM DESCRIPTION:
    A compiler parsing error on an initializer for an out-of-line
    definition of a template member variable.
    
    USERS AFFECTED:
    The problem will only affect initializers which have a template
    name in the qualifier.
    

Problem conclusion

  • The problem has been resolved, and the compiler no longer emits
    the error.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76253

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5724X1400

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2011-07-12

  • Closed date

    2011-10-24

  • Last modified date

    2011-10-24

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

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

    IV10074

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5724X1400

Applicable component levels

  • RB10 PSY

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"B10","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
17 October 2021