IBM Support

LI77056: TEMPLATE TYPE PROCESSING ORDER CAUSING ERROR

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When processing a template class type parameter, the compiler is
    incorrectly flagging a valid type as invalid.  The issue appears
    related to the order of class definitions and the location
    of user constructor definitions (inside, or outside their
    respective class).
    
    
       ===== TEST CASE =====
    
    template <class T>
    class Class1
    {
     public:
      Class1(const T& value = T());
    };
    
    template <class T>
    Class1<T>::Class1(const T&)
    {
    }
    
    template <class T>
    class Class2
    {
        Class1<T> mem;
      public:
        Class2() {}
    };
    
    struct myType
    {
    };
    
    int main(int argc, char *argv[])
    {
        Class2<myType> obj2;
    
        return 0;
    }
    
    
    $ xlC tmp.cpp
    line 5.41: 1540-0253 (S) This use of undefined class "myType" is
    not valid.
    line 18.14: 1540-1205 (I) The error occurred while converting to
    parameter 1 of "Class1<myType>::Class1(const myType &)".
    line 18.5: 1540-0700 (I) The previous message was produced while
    processing "Class2<myType>::Class2()".
    line 27.20: 1540-0700 (I) The previous message was produced
    while processing "main(int, char *[])".
    $
    

Local fix

  • Change location of class constructors, or change the order of
    the template type parameter class definitions.
    

Problem summary

  • PROBLEM DESCRIPTION:
    Name lookup of dependent name at the wrong location causes an
    incomplete type error.
    
    USERS AFFECTED:
    May be seen in code with template-dependent default arguments.
    

Problem conclusion

  • The fix has now been included in the V11.1 compiler release.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77056

  • 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

    2012-10-10

  • Closed date

    2012-10-10

  • Last modified date

    2012-10-10

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

    IV25325

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5724X1400

Applicable component levels



Document information

More support for: XL C/C++ for Linux

Software version: B10

Reference #: LI77056

Modified date: 10 October 2012