[PATCH][libstd++][PR92156]

Ville Voutilainen ville.voutilainen@gmail.com
Tue Apr 21 11:43:49 GMT 2020


On Tue, 21 Apr 2020 at 11:29, kamlesh kumar <kamleshbhalui@gmail.com> wrote:
>
> Added the fix for emplace.
>
> diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
> index 6b7e68f0e63..f35d90e548d 100644
> --- a/libstdc++-v3/include/std/any
> +++ b/libstdc++-v3/include/std/any
> @@ -178,30 +178,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      /// Construct with a copy of @p __value as the contained object.
>      template <typename _ValueType, typename _Tp = _Decay<_ValueType>,

While we're at it, we should rename _ValueType to _Tp and the decayed
type to _VTp,
so that it matches the standard's naming as close as possible, and
thus removes the ongoing
maintenance confusion about which is which.

> +int main() {
> +    auto a = std::any(std::in_place_type<std::any>, 5);
> +    auto b = std::any(std::in_place_type<std::any>, {1});
> +    std::any p = std::pair<std::any, std::any>(1, 1);
> +    (void)p;
> +    std::any t = std::tuple<std::any>(1);

I think this sort of tests should VERIFY that the constructed any
contains what we expect.
Iow, do an any_cast and check that, for instance, a and b contain an any.


More information about the Libstdc++ mailing list