Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jan 2013 17:10:01 GMT
From:      Eitan Adler <lists@eitanadler.com>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/175453: Catching C std::bad_cast doesn&#39;t work in FreeBSD 9.1
Message-ID:  <201301261710.r0QHA11J003897@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/175453; it has been noted by GNATS.

From: Eitan Adler <lists@eitanadler.com>
To: bug-followup@freebsd.org, hongli@phusion.nl
Cc:  
Subject: Re: standards/175453: Catching C std::bad_cast doesn&#39;t work in
 FreeBSD 9.1
Date: Sat, 26 Jan 2013 12:07:14 -0500

 This bug is probably well understood by now, but here is a minimal
 testcase for it (no includes, as few C++ features as possible):
 
  extern "C++" {
     namespace std {
       class exception   {
           const char* name() const     {
    }
      };
            class bad_cast : public exception   {
      };
    }
       }
       class foo {
    public:     virtual ~foo() {
   }
    };
        class bar: public foo {
    public:     int val;
        bar(): val(123) {
   }
    };
        static void cast_test(const foo &f) {
        try {
            const bar &b = dynamic_cast<const bar &>(f);
        }
    catch (const std::bad_cast &) {
        }
    }
        int main() {
        foo f;
        cast_test(f);
    }
 
 
 -- 
 Eitan Adler



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301261710.r0QHA11J003897>