IBM Support

IZ84764: MEMBER NOT DECLARED AS A TEMPLATE ERROR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Compiling the following test case TemplateBug.cpp with xlC emits
    error:
    
    "TemplateBug.cpp", line 19.1: 1540-1174 (S) The member "template
    const
    Bar<T,0,1> &Bang(const Bar &)" is not declared as a template in
    its
    containing class definition.
    
    
    
    ===== TESTCASE:
    > cat TemplateBug.cpp
    
    enum Foo { Alpha, Beta };
    
    template<typename T, Foo F, Foo G>
    class Bar;
    
    // Partial specialization of Bar
    template<typename T>
    class Bar<T,Alpha,Beta>
    {
    public:
        const Bar<T,Alpha,Beta>&
        Bang( const Bar<T,Alpha,Beta>& bar );
    };
    
    // Implementation of member function of partially specialized
    Bar
    template<typename T>
    const Bar<T,Alpha,Beta>&
    Bar<T,Alpha,Beta>::Bang
    ( const Bar<T,Alpha,Beta>& bar )
    { return bar; }
    
    // Explicit instantiation
    template class Bar<double,Alpha,Beta>;
    

Local fix

  • Changing const Bar<T,Alpha,Beta>& to void makes it pass. for
    example:
    
    
    >cat TemplateNoBug.cpp
    
    enum Foo { Alpha, Beta };
    
    template<typename T, Foo F, Foo G>
    class Bar;
    
    // Partial specialization of Bar
    template<typename T>
    class Bar<T,Alpha,Beta>
    {
    public:
        void
        Bang( const Bar<T,Alpha,Beta>& bar );
    };
    
    // Implementation of member function of partially specialized
    Bar
    template<typename T>
    void
    Bar<T,Alpha,Beta>::Bang
    ( const Bar<T,Alpha,Beta>& bar )
    { }
    
    // Explicit instantiation
    template class Bar<double,Alpha,Beta>;
    

Problem summary

  • PROBLEM DESCRIPTION:
    The compiler is failing to match the out-of-line definition of
    a template member with a non-type parameter which is an
    enumeration.
    
    USERS AFFECTED:
    The problem affects users of template classes with non-type
    parameters of enumeration type.
    

Problem conclusion

  • The compiler was incorrectly matching the out-of-line member
    when a non-type template parameter was an enumeration type.
    The problem is fixed now.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ84764

  • 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

    2010-09-10

  • Closed date

    2010-09-10

  • Last modified date

    2010-09-10

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

    LI75501

  • 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

[{"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:
10 September 2010