IBM Support

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

    IV11128

  • 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

    2011-11-22

  • Closed date

    2012-01-09

  • Last modified date

    2012-01-09

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

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

    LI76626

Fix information

  • Fixed component name

    XL C/C++ AIX

  • Fixed component ID

    5724X1300

Applicable component levels

  • RB10 PSY U849548

       UP C

[{"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:
09 January 2012