IBM Support

LI77630: UNDEFINED CLASS IS NOT VALID ERROR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Consider the following testcase:
    
    $cat b.cpp
    
    namespace ns {
        template<typename T> inline T f() { return T(); }
        template<> inline double f<double>() { return 0.001; }
    };
    
    template<typename T >
    class A1 {
        public: A1( const T& arg = ns::f<T>() ) {};
    };
    
    template<typename T>
    class D1 {
        public: D1(T t = 0) : t_(t) {};
        private: T t_;
    };
    
    class my {
        A1< D1<int> > a;
    
        public: my() ;
    };
    
    
    my::my() { };
    
    void ff() {
        my m;
        A1<double> ad;
    }
    
    Compiler incorrectly issues error:
    
    "b.cpp", line 7.40: 1540-0253 (S) This use of undefined class
    "D1<int>" is not valid.
    "b.cpp", line 20.10: 1540-1205 (I) The error occurred while
    converting to parameter 1 of "A1<D1<int> >::A1(const D1<int>
    &)".
    

Local fix

  • Avoid using the default argument or explicitly instantiate the
    required template class before using the default argument
    

Problem summary

  • USERS AFFECTED:
    The problem may be seen when a default function argument
    requires the implicit instantiation of a template class defined
    after the definition of the default argument
    but before the use of the default argument.
    
    PROBLEM DESCRIPTION:
    Template class implicit instantiation in a default function
    argument requested at the wrong point of instantiation causing
    an incomplete class error.
    

Problem conclusion

  • Compiler has been fixed so the implicit instantiation is
    requested where the default is used rather than where its
    defined.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77630

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-10-28

  • Closed date

    2013-10-28

  • Last modified date

    2013-10-28

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

    IV45506

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels

[{"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":"12.1","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
14 October 2021