IBM Support

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

    LI75501

  • Reported component name

    XL C/C++ AE BG/

  • Reported component ID

    5799HJE00

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-04-27

  • Closed date

    2010-07-28

  • Last modified date

    2010-07-28

Fix information

  • Fixed component name

    XL C/C++ AE BG/

  • Fixed component ID

    5799HJE00

Applicable component levels

  • R900 PSY

       UP



Document information

More support for: XL C/C++
Compiler

Software version: 9.0

Reference #: LI75501

Modified date: 28 July 2010


Translate this page: