IBM Support

IV72776: TEMPLATE FUNCTION NOT ABLE TO PARSE CHARACTER PROPERLY

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • A template function is not instantiated, and an incorrect
    template function is called when multiple template
    instantiations with the same function names with the same
    argument types exist.
    
    
    
       === TEST CASE ===
    
    extern "C" printf(const char*, ...);
    
    typedef const char (*templatetype)(const char);
    
    template <char pre>
    const char test(const char src )
    {
     if ( src != pre)
      {
      printf(" error src must be equal to pre\n");
     }
     return src == pre ? src  : 0;
    }
    
    class myClass
    {
     public:
        template <templatetype mx>
      const char check(const char start )
        {
          const char c = mx(start);
          if (c) return c;
          else return 0;
        }
    };
    
    int main()
    {
      myClass f;
      f.check < test<';'> >(';');
      f.check < test<'.'> >('.');
    }
    
    
    
    $ xlC test.cpp
    $ ./a.out
     error src must be equal to pre
    $
    

Local fix

Problem summary

  • USERS AFFECTED:
    Users with code that requires multiple template instantiations
    with same function names with same argument types are affected
    by this issue.
    
    PROBLEM DESCRIPTION:
    Template instantiation cache was selecting the cached
    candidate, looking at the arguments and assuming that the
    candidate is exact match.
    

Problem conclusion

  • The fix has been made so that the template instantiation cache
    is not used in case where function name and argument types are
    the same.
    This ensures that two separate instantiations happen when there
    is an ambiguity for the compiler.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV72776

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2015-04-27

  • Closed date

    2015-04-27

  • Last modified date

    2015-04-27

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

    IV68555

  • 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

  • RD10 PSY

       

[{"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":"13.1"}]

Document Information

Modified date:
01 October 2021