[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-23 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|---

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-23 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #23 from Jonathan Wakely --- Author: redi Date: Tue Apr 23 09:55:33 2019 New Revision: 270502 URL: https://gcc.gnu.org/viewcvs?rev=270502=gcc=rev Log: Fix std::variant regression caused by never-valueless optimization A regression

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-18 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #22 from Jonathan Wakely --- I'm tempted to just rip out this stuff entirely, and go back to only offering the strong exception safety guarantee for trivially copyable types, and so variants would only be never-valueless if all

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-18 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-05 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|---

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-05 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #19 from Jonathan Wakely --- Author: redi Date: Fri Apr 5 16:56:09 2019 New Revision: 270170 URL: https://gcc.gnu.org/viewcvs?rev=270170=gcc=rev Log: PR libstdc++/87431 re-adjust never-valueless optimizations Avoid creating

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-03 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #18 from Jonathan Wakely --- Proposed new patch posted: https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00142.html

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-04-02 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #16 from Jonathan Wakely --- Author: redi Date: Tue Jan 8 23:15:49 2019 New Revision: 267743 URL: https://gcc.gnu.org/viewcvs?rev=267743=gcc=rev Log: Pretty printer test fixes and improvements Test that StdUniquePtrPrinter

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-06 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|---

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-06 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #14 from Jonathan Wakely --- Author: redi Date: Sun Jan 6 20:52:34 2019 New Revision: 267614 URL: https://gcc.gnu.org/viewcvs?rev=267614=gcc=rev Log: PR libstdc++/87431 fix regression introduced by r264574 The previous patch for

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-06 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #13 from Antony Polukhin --- Yeah... but some whitelist of types to move could be hardcoded. For example std::basic_string, std::vector, std::unique_ptr and std::shared_ptr could be safely moved and `valueless_by_exception()` never

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-06 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #12 from Jonathan Wakely --- Yeah that unconditional move might actually be more expensive than just constructing directly. E.g. if the move constructor isn't really cheap, or if it will memcpy a large object. If an exception is rare

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-06 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #11 from Antony Polukhin --- Looks good. Note that boost::variant went further: if all the types are nothrow movable then variant always does the trick with moving from temporary. In that way `valueless_by_exception()` like states

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-04 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #10 from Jonathan Wakely --- Maybe like this: --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -439,7 +439,7 @@ namespace __variant constexpr bool _M_valid() const noexcept { -

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-10-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-10-08 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #8 from Antony Polukhin --- Here's an idea: Make valueless_by_exception() always false if all the alternatives are trivially copyable. Implement copying and constructions/emplace for such variants as a construction of a temporary +

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-10-07 Thread ensadc at mailnesia dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 ensadc at mailnesia dot com changed: What|Removed |Added CC||ensadc at mailnesia dot com

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-09-25 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #6 from Antony Polukhin --- (In reply to Jonathan Wakely from comment #5) > I'm going to mark this as fixed, I'm uncomfortable doing a smarter fix that > would be more fragile. +1. I'll keep searching for a less fragile solution.

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-09-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-09-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #4 from Jonathan Wakely --- Author: redi Date: Tue Sep 25 14:59:16 2018 New Revision: 264574 URL: https://gcc.gnu.org/viewcvs?rev=264574=gcc=rev Log: PR libstdc++/87431 optimise valueless_by_exception() If a std::variant can never

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-09-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #3 from Jonathan Wakely --- That makes me a little uncomfortable. Currently you can use something like: struct X { #ifndef NDEBUG X(int) noexcept(false); #endif //... }; bool test(std::variant const& v) { return

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-09-25 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #2 from Antony Polukhin --- New intrinsic could be added into the GCC... something like __builtin_all_constructors_nothrow(type)

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-09-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #1 from Jonathan Wakely --- Can we do any better than this? --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -439,6 +439,8 @@ namespace __variant constexpr bool _M_valid() const noexcept

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2018-09-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|