IBM Support

LI76626: COMPILE TIME ERROR WITH VARIADIC TEMPLATES

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • The following test case fails with a compile time error when
    using -qlanglvl=extended0x:
    
    ===== COMPILE COMMAND:
    xlC -qlanglvl=extended0x test.cpp
    
    ===== TESTCASE:
    $ cat test.cpp
    struct a
    {
        char* v;
        char* w;
    };
    
    template<class T>
    void func(T* v, int& n)
    {
        static const a table[] = {
              {"asdf", "ADFS"}
            , {"dfs", "dfk"}
            , {"adfks", 0}
        };
    
          n = sizeof(table);
    }
    
    int main(int argc, char* argv[])
    {
        int n;
        func(&n, n);
    }
    $
    
    
    ===== ACTUAL OUTPUT:
    $xlC -qlanglvl=extended0x test.cpp
    "test.cpp", line 17.11: 1540-0201 (S) The "sizeof" operator is
    not allowed for type "const a []".
    $
    
    ===== EXPECTED OUTPUT:
    Should compile clean.
    

Local fix

  • As a workaround, the test case can be compiled with
    -qlanglvl=extended0x:novariadictemplates to avoid the error
    message.
    

Problem summary

  • USERS AFFECTED:
    This would only be seen with -qtmplparse=error|warn or with
    -qlanglvl=variadictemplates.
    
    PROBLEM DESCRIPTION:
    The compiler produces an invalid error while processing sizeof
    in a template definition.
    

Problem conclusion

  • The compiler has been fixed to avoid producing an invalid error
    while processing sizeof in a template definition.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76626

  • 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-02-06

  • Closed date

    2012-02-06

  • Last modified date

    2012-02-06

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

    IV11128

  • 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 #: LI76626

Modified date: 06 February 2012