Message ID | CAFk2RUZ_dTkYxVWwcNoTVvUF2HNERiEFE73y6SQvByFwab2B_A@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Fri, 11 Dec 2015, Ville Voutilainen wrote: > Tested on Linux-PPC64. > > 2015-12-11 Ville Voutilainen <ville.voutilainen@gmail.com> > > PR libstdc++/68139 > > /libstdc++-v3 > * libsupc++/nested_exception.h (_S_rethrow): Use __std::addressof. ^^ Typo. > /testsuite > * 18_support/nested_exception/68139.cc: New.
On 11 December 2015 at 08:55, Marc Glisse <marc.glisse@inria.fr> wrote: > On Fri, 11 Dec 2015, Ville Voutilainen wrote: > >> Tested on Linux-PPC64. >> >> 2015-12-11 Ville Voutilainen <ville.voutilainen@gmail.com> >> >> PR libstdc++/68139 >> >> /libstdc++-v3 >> * libsupc++/nested_exception.h (_S_rethrow): Use __std::addressof. > > ^^ > > Typo. I must be blind, but I don't see what you mean. :)
On Fri, 11 Dec 2015, Ville Voutilainen wrote: > On 11 December 2015 at 08:55, Marc Glisse <marc.glisse@inria.fr> wrote: >> On Fri, 11 Dec 2015, Ville Voutilainen wrote: >> >>> Tested on Linux-PPC64. >>> >>> 2015-12-11 Ville Voutilainen <ville.voutilainen@gmail.com> >>> >>> PR libstdc++/68139 >>> >>> /libstdc++-v3 >>> * libsupc++/nested_exception.h (_S_rethrow): Use __std::addressof. >> >> ^^ >> >> Typo. > > I must be blind, but I don't see what you mean. :) Shouldn't the underscores apply to addressof, not to the namespace?
On 2015.12.11 at 09:50 +0200, Ville Voutilainen wrote: > On 11 December 2015 at 08:55, Marc Glisse <marc.glisse@inria.fr> wrote: > > On Fri, 11 Dec 2015, Ville Voutilainen wrote: > > > >> Tested on Linux-PPC64. > >> > >> 2015-12-11 Ville Voutilainen <ville.voutilainen@gmail.com> > >> > >> PR libstdc++/68139 > >> > >> /libstdc++-v3 > >> * libsupc++/nested_exception.h (_S_rethrow): Use __std::addressof. > > > > ^^ > > > > Typo. > > > I must be blind, but I don't see what you mean. :) std::__addressof not __std::addressof
On 11 December 2015 at 09:52, Marc Glisse <marc.glisse@inria.fr> wrote: >>>> /libstdc++-v3 >>>> * libsupc++/nested_exception.h (_S_rethrow): Use __std::addressof. >>> Typo. >> I must be blind, but I don't see what you mean. :) > Shouldn't the underscores apply to addressof, not to the namespace? Hah! Yes, thanks, I will fix that. :)
On 11/12/15 09:53 +0200, Ville Voutilainen wrote: >On 11 December 2015 at 09:52, Marc Glisse <marc.glisse@inria.fr> wrote: >>>>> /libstdc++-v3 >>>>> * libsupc++/nested_exception.h (_S_rethrow): Use __std::addressof. >>>> Typo. >>> I must be blind, but I don't see what you mean. :) >> Shouldn't the underscores apply to addressof, not to the namespace? > > >Hah! Yes, thanks, I will fix that. :) And we don't have separate changelogs for the libstdc++ testsuite, so it should be just: * libsupc++/nested_exception.h: ... * testsuite/18_support/nested_exception/68139.cc: ... Do we already include <bits/move.h> in freestanding implementations? Even if we don't, I think it's OK to do so, so the patch is OK with a corrected changelog.
diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h index a716f75..82b95df 100644 --- a/libstdc++-v3/libsupc++/nested_exception.h +++ b/libstdc++-v3/libsupc++/nested_exception.h @@ -37,6 +37,7 @@ #else #include <bits/c++config.h> +#include <bits/move.h> #if ATOMIC_INT_LOCK_FREE < 2 # error This platform does not support exception propagation. @@ -142,7 +143,8 @@ namespace std { static void _S_rethrow(const _Tp& __t) { - if (auto __tp = dynamic_cast<const nested_exception*>(&__t)) + if (auto __tp = + dynamic_cast<const nested_exception*>(std::__addressof(__t))) __tp->rethrow_nested(); } }; diff --git a/libstdc++-v3/testsuite/18_support/nested_exception/68139.cc b/libstdc++-v3/testsuite/18_support/nested_exception/68139.cc new file mode 100644 index 0000000..551f931 --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/nested_exception/68139.cc @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } +// { dg-require-atomic-builtins "" } + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <exception> + +// libstdc++/68139 +struct C { + virtual ~C(){} + void operator&() const = delete; +}; + +int main() { std::rethrow_if_nested(C()); } +