IBM Support

IV56821: MISSING DEFAULT ARGUMENT ON MEMBER FUNCTION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When compiling the following testcase, the compiler issues an
    error related to the number of arguments for a specific
    function when it should not.
    
    ===== COMPILE COMMAND:
    xlC -c b.cpp
    
    ===== TESTCASE:
    $ cat b.cpp
    typedef unsigned long size_t;
    
    typedef unsigned long _Bit_type;
    enum { _S_word_bit = int(8 * sizeof(_Bit_type)) };
    
     struct _Bit_iterator_base
      {};
    
    
    struct _Bit_iterator : public _Bit_iterator_base
      {
      };
    
    template<class _Alloc> struct _Bvector_base
    {
         typedef typename _Alloc::template rebind<_Bit_type>::other
    _Bit_alloc_type;
    
         struct _Bvector_impl : public _Bit_alloc_type
         {
         _Bit_iterator  _M_start;
         _Bit_iterator  _M_finish;
         _Bit_type*  _M_end_of_storage;
         _Bvector_impl(const _Bit_alloc_type& __a) ;
         };
    
          typedef _Alloc allocator_type;
    
          _Bvector_base(const allocator_type& __a) ;
    
    
      _Bvector_impl _M_impl;
    
         _Bit_type*  _M_allocate(size_t __n)
         { return _M_impl.allocate((__n + int(_S_word_bit) - 1) /
    int(_S_word_bit)); }
    
    };
    
    
    template <typename T>
    struct Allocator
    {
       typedef size_t    size_type;
       typedef T *       pointer;
    
       Allocator();
    
       template <typename U>
       struct rebind
       {
          typedef Allocator<U> other;
       };
    
       pointer allocate( size_type n, const void* hint = 0);
    
    };
    
    void tester(size_t a)
    {
       Allocator<bool> alloc;
       _Bvector_base<Allocator<bool> > x(alloc);
       x._M_allocate(a);
    }
    $
    
    
    
    ===== ACTUAL OUTPUT:
    $ xlC b.cpp -c
    "b.cpp", line 43.31: 1540-0215 (S) The wrong number of
    arguments has been specified for "Allocator<unsigned
    long>::allocate(size_type, const void *)".
    "b.cpp", line 41.18: 1540-0700 (I) The previous message was
    produced while processing "_Bvector_base<Allocator<bool>
    >::_M_allocate(size_t)".
    "b.cpp", line 73.5: 1540-0700 (I) The previous message was
    produced while processing "tester(size_t)".
    $
    
    
    ===== EXPECTED OUTPUT:
    Clean compile
    

Local fix

  • Workaround by specifying the default argument in the call
    
    <      { return _M_impl.allocate((__n + int(_S_word_bit) - 1) /
    int(_S_word_bit)); }
    ---
    >      { return _M_impl.allocate((__n + int(_S_word_bit) - 1) /
    int(_S_word_bit),0); }
    

Problem summary

  • USERS AFFECTED:
    The problem may be seen when using a default argument from an
    inline member function of a template class.
    If there is a call to a function with a default, that call uses
    the default and the function with the default is after the
    call.
    The compile may not pick up the default argument in specific
    cases.
    
    PROBLEM DESCRIPTION:
    The compiler missed picking up a default argument.
    

Problem conclusion

  • The compiler has been fixed to pick up the default argument.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV56821

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-03-18

  • Closed date

    2014-03-18

  • Last modified date

    2014-03-19

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

    LI77602

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

Fix information

  • Fixed component name

    XL C/C++ FOR AI

  • Fixed component ID

    5725C7200

Applicable component levels

[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1"}]

Document Information

Modified date:
03 October 2021