template<typename _Res>
class future : public __basic_future<_Res>
{
+ // _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");
+
friend class promise<_Res>;
template<typename> friend class packaged_task;
template<typename _Fn, typename... _Args>
template<typename _Res>
class shared_future : public __basic_future<_Res>
{
+ // _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");
+
typedef __basic_future<_Res> _Base_type;
public:
template<typename _Res>
class promise
{
+ // _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");
+
typedef __future_base::_State_base _State;
typedef __future_base::_Result<_Res> _Res_type;
typedef __future_base::_Ptr<_Res_type> _Ptr_type;
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+// LWG 3458
+// Is shared_future intended to work with arrays or function types?
+
+#include <future>
+
+std::future<int(&)[1]> good;
+std::future<int(&)()> good2;
+
+std::future<int[1]> bad; // { dg-error "here" }
+// { dg-error "result type is not 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-prune-output "function returning a function" }
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+// LWG 3466
+// Specify the requirements for promise/future/shared_future consistently
+
+#include <future>
+
+std::promise<int(&)[1]> good;
+std::promise<int(&)()> good2;
+
+std::promise<int[1]> bad; // { dg-error "here" }
+// { dg-error "result type is not 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-prune-output {'sizeof \(int\(\)\)'} }
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+// LWG 3458
+// Is shared_future intended to work with arrays or function types?
+
+#include <future>
+
+std::shared_future<int(&)[1]> good;
+std::shared_future<int(&)()> good2;
+
+std::shared_future<int[1]> bad; // { dg-error "here" }
+// { dg-error "result type is not an array" "" { target *-*-* } 0 }
+
+std::shared_future<int()> bad2; // { dg-error "here" }
+// { dg-error "result type is not a function" "" { target *-*-* } 0 }