IBM Support

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

    LI77966

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-04-30

  • Closed date

    2014-04-30

  • Last modified date

    2014-04-30

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

    IV56872

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels

  • RC10 PSY

       UP



Document information

More support for: XL C/C++ for Linux
Compiler

Software version: 12.1

Reference #: LI77966

Modified date: 30 April 2014