{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3458. Is shared_future intended to work with arrays or function types?
- static_assert(!is_array<_Res>{}, "result type is not an array");
- static_assert(!is_function<_Res>{}, "result type is not a function");
+ static_assert(!is_array<_Res>{}, "result type must not be an array");
+ static_assert(!is_function<_Res>{}, "result type must not be a function");
+ static_assert(is_destructible<_Res>{},
+ "result type must be destructible");
friend class promise<_Res>;
template<typename> friend class packaged_task;
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3458. Is shared_future intended to work with arrays or function types?
- static_assert(!is_array<_Res>{}, "result type is not an array");
- static_assert(!is_function<_Res>{}, "result type is not a function");
+ static_assert(!is_array<_Res>{}, "result type must not be an array");
+ static_assert(!is_function<_Res>{}, "result type must not be a function");
+ static_assert(is_destructible<_Res>{},
+ "result type must be destructible");
typedef __basic_future<_Res> _Base_type;
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3466: Specify the requirements for promise/future/[...] consistently
- static_assert(!is_array<_Res>{}, "result type is not an array");
- static_assert(!is_function<_Res>{}, "result type is not a function");
+ static_assert(!is_array<_Res>{}, "result type must not be an array");
+ static_assert(!is_function<_Res>{}, "result type must not be a function");
+ static_assert(is_destructible<_Res>{},
+ "result type must be destructible");
typedef __future_base::_State_base _State;
typedef __future_base::_Result<_Res> _Res_type;
std::future<int(&)()> good2;
std::future<int[1]> bad; // { dg-error "here" }
-// { dg-error "result type is not an array" "" { target *-*-* } 0 }
+// { dg-error "result type must not be an array" "" { target *-*-* } 0 }
// { dg-prune-output "function returning an array" }
std::future<int()> bad2; // { dg-error "here" }
-// { dg-error "result type is not a function" "" { target *-*-* } 0 }
+// { dg-error "result type must not be a function" "" { target *-*-* } 0 }
// { dg-prune-output "function returning a function" }
+
+struct Indestructible { ~Indestructible() = delete; };
+std::future<Indestructible> bad3; // { dg-error "here" }
+// { dg-error "result type must be destructible" "" { target *-*-* } 0 }
+// { dg-prune-output {deleted function} }
+
+class PrivateDtor { public: PrivateDtor(); private: ~PrivateDtor(); };
+std::future<PrivateDtor> bad4; // { dg-error "here" }
+// { dg-prune-output {is private} }
std::promise<int(&)()> good2;
std::promise<int[1]> bad; // { dg-error "here" }
-// { dg-error "result type is not an array" "" { target *-*-* } 0 }
+// { dg-error "result type must not be an array" "" { target *-*-* } 0 }
// { dg-prune-output {request for member '~int \[1\]'} }
std::promise<int()> bad2; // { dg-error "here" }
-// { dg-error "result type is not a function" "" { target *-*-* } 0 }
+// { dg-error "result type must not be a function" "" { target *-*-* } 0 }
// { dg-prune-output {'sizeof \(int\(\)\)'} }
+
+struct Indestructible { ~Indestructible() = delete; };
+std::promise<Indestructible> bad3; // { dg-error "here" }
+// { dg-error "result type must be destructible" "" { target *-*-* } 0 }
+// { dg-prune-output {deleted function} }
+
+class PrivateDtor { public: PrivateDtor(); private: ~PrivateDtor(); };
+std::promise<PrivateDtor> bad4; // { dg-error "here" }
+// { dg-prune-output {is private} }
std::shared_future<int(&)()> good2;
std::shared_future<int[1]> bad; // { dg-error "here" }
-// { dg-error "result type is not an array" "" { target *-*-* } 0 }
+// { dg-error "result type must not be an array" "" { target *-*-* } 0 }
std::shared_future<int()> bad2; // { dg-error "here" }
-// { dg-error "result type is not a function" "" { target *-*-* } 0 }
+// { dg-error "result type must not be a function" "" { target *-*-* } 0 }
+
+struct Indestructible { ~Indestructible() = delete; };
+std::shared_future<Indestructible> bad3; // { dg-error "here" }
+// { dg-error "result type must be destructible" "" { target *-*-* } 0 }
+// { dg-prune-output {deleted function} }
+
+class PrivateDtor { public: PrivateDtor(); private: ~PrivateDtor(); };
+std::shared_future<PrivateDtor> bad4; // { dg-error "here" }
+// { dg-prune-output {is private} }