This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52099] New: Incorrectly applying conversion when catching pointer-to-members


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52099

             Bug #: 52099
           Summary: Incorrectly applying conversion when catching
                    pointer-to-members
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jens.maurer@gmx.net


The follwing program shows that gcc erroneously matches an exception object of
a pointer-to-member type to a handler of (slightly) different type.  There is
no allowance in 15.3 [except handle] to do that.  In particular, adding a
cv-qualifier on top of the pointer-to-member type (which would be allowed)
cannot morph a pointer-to-nonconst-member function into a
pointer-to-const-member function.


#include <cassert>

struct A
{
    void foo() {}
};

int main()
{
    try
    {
        throw &A::foo;
    }
    catch (void (A::*)() const)
    {
        assert(false);   // g++ currently takes this route
    }
    catch (...)
    {
    }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]