libstdc++: Fix constructor constraints for std::any (PR 90415)
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 23:54:20 +0000 (00:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 23:54:20 +0000 (00:54 +0100)
commitd1462b0782555354b4480e1f46498586d5882972
tree5e31e22610f4c0e69c465c88c1bf9dea4ef07d0c
parentae962e573ea5063fda7e86f93d9622e64cea9a7e
libstdc++: Fix constructor constraints for std::any  (PR 90415)

This removes a non-standard extension to std::any which causes errors
for valid code, due to recursive instantiation of a trait that isn't
supposed to be in the constraints.

It also removes some incorrect constraints on the in_place_type<T>
constructors and emplace members, which were preventing creating a
std::any object with another std::any as the contained value.

2020-04-24  Kamlesh Kumar  <kamleshbhalui@gmail.com>
    Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/90415
PR libstdc++/92156
* include/std/any (any): Rename template parameters for consistency
with the standard.
(any::_Decay): Rename to _Decay_if_not_any.
(any::any(T&&):: Remove is_constructible from constraints. Remove
non-standard overload.
(any::any(in_place_type_t<T>, Args&&...))
(any::any(in_place_type_t<T>, initializer_list<U>, Args&&...))
(any::emplace(Args&&...))
(any::emplace(initializer_list<U>, Args&&...)):
Use decay_t instead of _Decay.
* testsuite/20_util/any/cons/90415.cc: New test.
* testsuite/20_util/any/cons/92156.cc: New Test.
* testsuite/20_util/any/misc/any_cast_neg.cc: Make dg-error directives
more robust.
* testsuite/20_util/any/modifiers/92156.cc: New test.
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/any
libstdc++-v3/testsuite/20_util/any/cons/90415.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/any/cons/92156.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/any/misc/any_cast_neg.cc
libstdc++-v3/testsuite/20_util/any/modifiers/92156.cc [new file with mode: 0644]