[Bug libstdc++/90165] std::variant constructs wrong alternative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90165 --- Comment #5 from Jonathan Wakely --- Author: redi Date: Tue May 7 15:46:36 2019 New Revision: 270966 URL: https://gcc.gnu.org/viewcvs?rev=270966=gcc=rev Log: PR libstdc++/90165 constrain variant(T&&) constructor Backport from mainline 2019-04-23 Jonathan Wakely PR libstdc++/90165 * include/std/variant (variant::__is_in_place_tag) (variant::__not_in_place_tag): New helpers for variant(T&&) constructor constraint. (variant::variant(T&&)): Use __not_in_place_tag in constraints. * testsuite/20_util/variant/compile.cc: Check variant(T&&) constructor isn't used for in_place_type or in_place_index arguments. Modified: branches/gcc-8-branch/libstdc++-v3/ChangeLog branches/gcc-8-branch/libstdc++-v3/include/std/variant branches/gcc-8-branch/libstdc++-v3/testsuite/20_util/variant/compile.cc
[Bug libstdc++/90165] std::variant constructs wrong alternative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90165 Jonathan Wakely changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #6 from Jonathan Wakely --- Fixed for 8.4 too.
[Bug libstdc++/90165] std::variant constructs wrong alternative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90165 Jonathan Wakely changed: What|Removed |Added Keywords||accepts-invalid Known to work||9.0 Target Milestone|--- |8.4 Known to fail||8.3.0 --- Comment #4 from Jonathan Wakely --- Fixed on trunk so far.
[Bug libstdc++/90165] std::variant constructs wrong alternative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90165 --- Comment #3 from Jonathan Wakely --- Author: redi Date: Tue Apr 23 12:48:18 2019 New Revision: 270509 URL: https://gcc.gnu.org/viewcvs?rev=270509=gcc=rev Log: PR libstdc++/90165 constrain variant(T&&) constructor Also refactor some constraints slightly to be more readable. PR libstdc++/90165 * include/std/variant (variant::__not_self): New helper for the is_same_v, variant>==false constraints. (variant::__to_type_impl): Remove. (variant::__to_type): Add default argument to check pack size, instead of using __to_type_impl. (variant::__accepted_type): Add default argument using __not_self. (variant::__is_in_place_tag, variant::__not_in_place_tag): New helpers for variant(T&&) constructor constraint. (variant::variant(T&&)): Use __not_in_place_tag in constraints. Extract __accepted_type into a named template parameter for reuse in other constraints and in the exception specification. (variant::variant(in_place_type_t, Args&&...)) (variant::variant(in_place_type_t, initializer_list, Args&&...)) (variant::variant(in_place_index_t, Args&&...)) (variant::variant(in_place_index_t, initializer_list, Args&&...)) (variant::operator=T&&)): Remove redundant && from trait arguments. * testsuite/20_util/variant/compile.cc: Check variant(T&&) constructor isn't used for in_place_type or in_place_index arguments. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/std/variant trunk/libstdc++-v3/testsuite/20_util/variant/compile.cc
[Bug libstdc++/90165] std::variant constructs wrong alternative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90165 --- Comment #2 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #1) > because we talk to apply this constraint: s/talk/fail/
[Bug libstdc++/90165] std::variant constructs wrong alternative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90165 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2019-04-19 Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- The variant(T&&) constructor is being selected by overload resolution, because we talk to apply this constraint: remove_cvref_t is neither a specialization of in_place_type_t nor a specialization of in_place_index_t,