diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-07-20 19:21:48 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2016-07-20 19:21:48 +0100 |
commit | 18407bfb2c2a34648ac7a1a8ebaa9a72a04126c6 (patch) | |
tree | c098d81960006323e6c0be48ab05026e6e2544ec /gcc | |
parent | 4c07fd98b80242f8d4fd30e6264150826c21cee6 (diff) | |
download | gcc-18407bfb2c2a34648ac7a1a8ebaa9a72a04126c6.zip gcc-18407bfb2c2a34648ac7a1a8ebaa9a72a04126c6.tar.gz gcc-18407bfb2c2a34648ac7a1a8ebaa9a72a04126c6.tar.bz2 |
Use static pointer to member when catching nullptr
libstdc++-v3:
* libsupc++/pbase_type_info.cc (__pbase_type_info::__do_catch): Use
static objects for catching nullptr as pointer to member types.
gcc/testsuite:
* g++.dg/cpp0x/nullptr35.C: Change expected result for catching as
pointer to member function and also test catching by reference.
From-SVN: r238532
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/nullptr35.C | 33 |
2 files changed, 36 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef0270e..1fbf173 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-20 Jonathan Wakely <jwakely@redhat.com> + + * g++.dg/cpp0x/nullptr35.C: Change expected result for catching as + pointer to member function and also test catching by reference. + 2016-07-20 Dominik Vogt <vogt@linux.vnet.ibm.com> * gcc.target/s390/pr67443.c: Fix test case. diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr35.C b/gcc/testsuite/g++.dg/cpp0x/nullptr35.C index c84966f..d932114 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nullptr35.C +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr35.C @@ -39,7 +39,7 @@ int main() caught(4); throw; } - } catch (int (A::*pmf)()) { // FIXME: currently unsupported + } catch (int (A::*pmf)()) { if (pmf == nullptr) caught(8); throw; @@ -47,6 +47,35 @@ int main() } catch (nullptr_t) { } - if (result != 7) // should be 15 + try { + try { + try { + try { + try { + throw nullptr; + } catch (void* const& p) { + if (p == nullptr) + caught(16); + throw; + } + } catch (void(* const& pf)()) { + if (pf == nullptr) + caught(32); + throw; + } + } catch (int A::* const& pm) { + if (pm == nullptr) + caught(64); + throw; + } + } catch (int (A::* const& pmf)()) { + if (pmf == nullptr) + caught(128); + throw; + } + } catch (nullptr_t) { + } + + if (result != 255) abort (); } |