IBM Support

IV56872: NO BEST MATCH FOR METHOD WITH THROW SPECIFIER

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The compiler is outputting an error message that it can not find
    a match for a method in a parent class, when a method with the
    same name is found in the child class, or vice versa.
    
    The error is triggered by one (but not both) of the methods
    using a 'throw()' exception specifier.
    
    
        ==== TEST CASE ===
    
    class A1 {
      public:
        void test(int) throw();
    };
    class A2: public A1 {
      public:
        using A1::test;
        void test(int);
        void func() { test(1); }
    };
    
    
    $ xlC -c test.cpp
    "test.cpp", line 9.19: 1540-0219
        (S) The call to "test" has no best match.
    "test.cpp", line 9.19: 1540-1230
        (I) Argument number 1 is the implicit "this" argument.
    "test.cpp", line 9.24: 1540-1229
        (I) Argument number 2 is an rvalue of type "int".
    "test.cpp", line 3.10: 1540-1202
        (I) No candidate is better than "A1::test(int)".
    "test.cpp", line 9.19: 1540-1231
        (I) The conversion from argument number 1 to "A2 &" uses
            "the identity conversion".
    "test.cpp", line 9.24: 1540-1231
        (I) The conversion from argument number 2 to "int" uses "the
            identity conversion".
    "test.cpp", line 8.10: 1540-1202
        (I) No candidate is better than "A2::test(int)".
    "test.cpp", line 9.19: 1540-1231
        (I) The conversion from argument number 1 to "A2 &" uses
            "the identity conversion".
    "test.cpp", line 9.24: 1540-1231
        (I) The conversion from argument number 2 to "int" uses "the
            identity conversion".
    $
    

Local fix

  • Remove the 'throw()' exception specifier, or add one to the
    other method, in either the parent or child classes.
    

Problem summary

  • PROBLEM DESCRIPTION:
    The compiler was not able to handle the throw() specifier
    properly in overload resolution.
    
    USERS AFFECTED:
    Users with the throw() specifier in their class with another
    function with same name.
    

Problem conclusion

  • The compiler can now correctly handle throw specifiers.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV56872

  • 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-20

  • Closed date

    2014-07-18

  • Last modified date

    2014-07-18

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

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

    LI77966

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