IBM Support

IV10074: 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

    IV10074

  • Reported component name

    XL C/C++ AIX

  • Reported component ID

    5724X1300

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-11-02

  • Closed date

    2011-11-02

  • Last modified date

    2011-11-03

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

    LI76253

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

Fix information

  • Fixed component name

    XL C/C++ AIX

  • Fixed component ID

    5724X1300

Applicable component levels

  • RB10 PSN U848679

       UP06/09/13 C

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
03 November 2011