public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52099] New: Incorrectly applying conversion when catching pointer-to-members
@ 2012-02-02 22:23 jens.maurer at gmx dot net
  2015-03-25 16:55 ` [Bug c++/52099] " paolo.carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jens.maurer at gmx dot net @ 2012-02-02 22:23 UTC (permalink / raw)
  To: gcc-bugs

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 (...)
    {
    }
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-09 23:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-02 22:23 [Bug c++/52099] New: Incorrectly applying conversion when catching pointer-to-members jens.maurer at gmx dot net
2015-03-25 16:55 ` [Bug c++/52099] " paolo.carlini at oracle dot com
2021-07-23 20:38 ` pinskia at gcc dot gnu.org
2021-07-25 20:17 ` redi at gcc dot gnu.org
2021-08-09 21:02 ` pinskia at gcc dot gnu.org
2021-08-09 23:20 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).