libstdc++: Rename test type to avoid clashing with std::any
authorJonathan Wakely <jwakely@redhat.com>
Mon, 10 May 2021 12:57:49 +0000 (13:57 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 10 May 2021 14:00:06 +0000 (15:00 +0100)
When PCH are enabled this test file includes <any> and so the
using-directive brings std::any into the global scope. It isn't
currently a problem, because the -std option in the dg-options means
that PCH is not used. If that option is removed, the test fails with PCH
and passes without.

This just renames the type to avoid the name classh (and also the 'none'
type for consistency).

libstdc++-v3/ChangeLog:

* testsuite/20_util/variant/compile.cc: Rename 'any' to avoid
clash with std::any.

libstdc++-v3/testsuite/20_util/variant/compile.cc

index 33f198c..e504275 100644 (file)
@@ -172,15 +172,15 @@ void arbitrary_ctor()
   static_assert(is_constructible_v<variant<bool, int>, ConvertibleToBool>);
 }
 
-struct none { none() = delete; };
-struct any { template <typename T> any(T&&) {} };
+struct None { None() = delete; };
+struct Any { template <typename T> Any(T&&) {} };
 
 void in_place_index_ctor()
 {
   variant<string, string> a(in_place_index<0>, "a");
   variant<string, string> b(in_place_index<1>, {'a'});
 
-  static_assert(!is_constructible_v<variant<none, any>, std::in_place_index_t<0>>, "PR libstdc++/90165");
+  static_assert(!is_constructible_v<variant<None, Any>, std::in_place_index_t<0>>, "PR libstdc++/90165");
 }
 
 void in_place_type_ctor()
@@ -188,7 +188,7 @@ void in_place_type_ctor()
   variant<int, string, int> a(in_place_type<string>, "a");
   variant<int, string, int> b(in_place_type<string>, {'a'});
   static_assert(!is_constructible_v<variant<string, string>, in_place_type_t<string>, const char*>);
-  static_assert(!is_constructible_v<variant<none, any>, std::in_place_type_t<none>>, "PR libstdc++/90165");
+  static_assert(!is_constructible_v<variant<None, Any>, std::in_place_type_t<None>>, "PR libstdc++/90165");
 }
 
 void dtor()