22.10.17 Polymorphic function wrappers [func.wrap] C++N4910:2022 (627) p756.cpp

# はじめに(Introduction)
N4910  Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf

n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM）との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

 <この項は書きかけです。順次追記します。>

## 背景(back ground)
C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに１回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を１０種類以上、最近になって解決できたことがあります。それは、主に次の３つの情報に基づいています。

https://stackoverflow.com

http://ja.cppreference.com/

cpprefjp - C++日本語リファレンス

https://cpprefjp.github.io/

コンパイラの実装状況

https://cpprefjp.github.io/implementation-status.html

また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。

## 作業方針(sequence)
Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの２種類
でコンパイルし、

１）コンパイルエラーを収集する。
２）コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
３）リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
４）意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

１）だけのものから４）まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

### C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list  

https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

### C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
https://qiita.com/kaizen_nagoya/items/3294c014044550896010

### C++N4606, 2016符号断片編纂一覧(example code compile list)
C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

### C++N3242, 2011 sample code compile list on clang++ and g++
https://qiita.com/kaizen_nagoya/items/685b5c1a2c17c1bf1318

## 編纂器(Compiler)
### clang++ --version
> Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin

### g++- --version
> g++ (GCC) 12.1.0  Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# 22.10.17 Polymorphic function wrappers [func.wrap] C++N4910:2022 (627) p756.cpp

## 算譜(source code)

```c++:p756.cpp
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "22.10.17 Polymorphic function wrappers [func.wrap] C++N4910:2022 (627) p756.cpp";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
// https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

#include "N4910.h"

using namespace std;

// 22.10.17.1 General [func.wrap.general]
// Subclause 22.10.17 describes polymorphic wrapper classes that encapsulate arbitrary callable objects.
// 22.10.17.2 Class bad_function_call [func.wrap.badcall]
//  An exception of type bad_function_call is thrown by function::operator() (22.10.17.3.5) when the function wrapper object has no target.
namespace std {
class bad_function_call : public exception {
public:
// see 17.9.3 for the specification of the special member functions
    const char* what() const noexcept override;
};
}
const char* what() const noexcept override;
// 22.10.17.3 Class template function  [func.wrap.func]
// 22.10.17.3.1 General  [func.wrap.func.general]
namespace std {
template<class> class function;
template<class R, class... ArgTypes>
class function<R(ArgTypes...)> {
public:
    using result_type = R;
// 22.10.17.3.2, construct/copy/destroy function() noexcept; function(nullptr_t) noexcept; function(const function&); function(function&&) noexcept; template<class F> function(F&&);
    function& operator=(const function&);
    function& operator=(function&&);
    function& operator=(nullptr_t) noexcept;
    template<class F> function& operator=(F&&);
    template<class F> function& operator=(reference_wrapper<F>) noexcept;
    ~function();
// 22.10.17.3.3, function modifiers
    void swap(function&) noexcept;
// not defined
// Postconditions: !*this.
// 22.10.17.3.4, function capacity
    explicit operator bool() const noexcept;
// 22.10.17.3.5, function invocation R operator()(ArgTypes...) const;
// 22.10.17.3.6, function target access
    const type_info& target_type() const noexcept;
    template<class T> T* target() noexcept;
    template<class T> const T* target() const noexcept;
};
template<class R, class... ArgTypes>
function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
template<class F> function(F) -> function<see_below>;
}
//  The function class template provides polymorphic wrappers that generalize the notion of a function pointer. Wrappers can store, copy, and call arbitrary callable objects (22.10.3), given a call signature (22.10.3).
//  A callable type (22.10.3) F is Lvalue-Callable for argument types ArgTypes and return type R if the expression INVOKE<R>(declval<F&>(), declval<ArgTypes>()...), considered as an unevaluated operand (7.2.3), is well-formed (22.10.4).
//  The function class template is a call wrapper (22.10.3) whose call signature (22.10.3) is R(ArgTypes...).
//  [Note 1: The types deduced by the deduction guides for function might change in future revisions of C++.
// 22.10.17.3.2 Constructors and destructor [func.wrap.func.con]
function() noexcept;
// Postconditions: !*this. function(nullptr_t) noexcept;
function(const function& f);
// Postconditions: !*this if !f; otherwise, the target object of *this is a copy of f.target().
// Throws: Nothing if f’s target is a specialization of reference_wrapper or a function pointer. Otherwise, may throw bad_alloc or any exception thrown by the copy constructor of the stored callable object.
// Recommended practice: Implementations should avoid the use of dynamically allocated memory for small callable objects, for example, where f’s target is an object holding only a pointer or reference to an object and a member function pointer.
function(function&& f) noexcept;
// Postconditions: If !f, *this has no target; otherwise, the target of *this is equivalent to the target of f before the construction, and f is in a valid state with an unspecified value.
// Recommended practice: Implementations should avoid the use of dynamically allocated memory for small callable objects, for example, where f’s target is an object holding only a pointer or reference to an object and a member function pointer.
template<class F> function(F&& f);
// Let FD be decay_t<F>. Constraints:
// — is_same_v<remove_cvref_t<F>, function> is false, and
// — FD is Lvalue-Callable (22.10.17.3) for argument types ArgTypes... and return type R.
// Mandates:
// — is_copy_constructible_v<FD> is true, and
// — is_constructible_v<FD, F> is true.
// Preconditions: FD meets the Cpp17CopyConstructible requirements.
// Postconditions: !*this is true if any of the following hold:
// — f is a null function pointer value.
// — f is a null member pointer value.
// — remove_cvref_t<F> is a specialization of the function class template, and !f is true. Otherwise, *this has a target object of type FD direct-non-list-initialized with std::forward<F>(f).
// Throws: Nothing if FD is a specialization of reference_wrapper or a function pointer type. Otherwise, may throw bad_alloc or any exception thrown by the initialization of the target object.
// Recommended practice: Implementations should avoid the use of dynamically allocated memory for small callable objects, for example, where f refers to an object holding only a pointer or reference to an object and a member function pointer.
template<class F> function(F) -> function<see_below>;
// Constraints: &F::operator() is well-formed when treated as an unevaluated operand and decltype( &F::operator()) is of the form R(G::*)(A...) cv &opt noexceptopt for a class type G.
// Remarks: The deduced type is function<R(A...)>.
// [Example 1:
void f() {
    int i{5};
    function g = [&](double) {
        return i;
    };
}
// deduces function<int(double)>
function& operator=(const function& f);
// Effects: As if by function(f).swap(*this); Returns: *this.
function& operator=(function&& f);
// Effects: Replaces the target of *this with the target of f. Returns: *this.
function& operator=(nullptr_t) noexcept;
// Effects: If *this != nullptr, destroys the target of this. Postconditions: !(*this).
// Returns: *this.
template<class F> function& operator=(F&& f);
// Constraints: decay_t<F> is Lvalue-Callable (22.10.17.3) for argument types ArgTypes... and return type R.
// Effects: As if by: function(std::forward<F>(f)).swap(*this); Returns: *this.
template<class F> function& operator=(reference_wrapper<F> f) noexcept;
// Effects: As if by: function(f).swap(*this); Returns: *this.
~function();
// Effects: If *this != nullptr, destroys the target of this.
// — cv is either const or empty,
// — ref is either &, &&, or empty, and — noex is either true or false.
// — If ref is empty, let inv-quals be cv &, — otherwise, let inv-quals be cv ref.
// 22.10.17.4.2 Class template move_only_function
namespace std {
template<class... S> class move_only_function;
template<class R, class... ArgTypes>
class move_only_function<R(ArgTypes...) cv ref public:
    using result_type = R;
// 22.10.17.3.3 Modifiers [func.wrap.func.mod]
void swap(function& other) noexcept;
//  The header provides partial specializations of move_only_function for each combination of the possible replacements of the placeholders cv, ref, and noex where
// Effects: Interchanges the target objects of *this and other.
// 22.10.17.3.4 Capacity [func.wrap.func.cap]
explicit operator bool() const noexcept;
// Returns: true if *this has a target, otherwise false.
// 22.10.17.3.5 Invocation [func.wrap.func.inv]
R operator()(ArgTypes... args) const;
// Returns: INVOKE<R>(f, std::forward<ArgTypes>(args)...) (22.10.4), where f is the target object (22.10.3) of *this.
// Throws: bad_function_call if !*this; otherwise, any exception thrown by the target object.
// 22.10.17.3.6 Target access [func.wrap.func.targ]
const type_info& target_type() const noexcept;
// Returns: If *this has a target of type T, typeid(T); otherwise, typeid(void).
template<class T> T* target() noexcept;
template<class T> const T* target() const noexcept;
// Returns: If target_type() == typeid(T) a pointer to the stored function target; otherwise a null pointer.
// 22.10.17.3.7 Null pointer comparison operator functions [func.wrap.func.nullptr]
template<class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>& f, nullptr_t) noexcept;
// Returns: !f.
// 22.10.17.3.8 Specialized algorithms [func.wrap.func.alg]
template<class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>& f1, function<R(ArgTypes...)>& f2) noexcept;
// Effects: As if by: f1.swap(f2);
// 22.10.17.4 Move only wrapper [func.wrap.move]
// 22.10.17.4.1 General [func.wrap.move.general]
//  For each of the possible combinations of the placeholders mentioned above, there is a placeholder inv-quals defined as follows:
// 22.10.17.4.2. Class template move_only_function [func.wrap.move.class]
// not defined
// If noex is true, is-callable-from <VT> is equal to: is_nothrow_invocable_r_v<R, VT cv ref , ArgTypes...> && is_nothrow_invocable_r_v<R, VT inv-quals, ArgTypes...> Otherwise, is-callable-from <VT> is equal to: is_invocable_r_v<R, VT cv ref , ArgTypes...> && is_invocable_r_v<R, VT inv-quals, ArgTypes...>
namespace std {
template<class... S> class move_only_function;
template<class R, class... ArgTypes>
class move_only_function<R(ArgTypes...) cv ref public:
    using result_type = R;
// 22.10.17.4.3, constructors, assignment, and destructor
move_only_function() noexcept;
move_only_function(nullptr_t) noexcept;
move_only_function(move_only_function&&) noexcept;
template<class F> move_only_function(F&&);
template<class T, class... Args>
explicit move_only_function(in_place_type_t<T>, Args&&...);
template<class T, class U, class... Args>
explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
move_only_function& operator=(move_only_function&&);
move_only_function& operator=(nullptr_t) noexcept;
template<class F> move_only_function& operator=(F&&);
~move_only_function();
// 22.10.17.4.4, invocation
explicit operator bool() const noexcept;
R operator()(ArgTypes...) cv ref noexcept(noex );
// 22.10.17.4.5, utility
void swap(move_only_function&) noexcept;
friend void swap(move_only_function&, move_only_function&) noexcept;
friend bool operator==(const move_only_function&, nullptr_t) noexcept;
private:
template<class VT>
static constexpr bool is-callable-from = see_below ; // exposition only
};
}
//  The move_only_function class template provides polymorphic wrappers that generalize the notion of a callable object (22.10.3). These wrappers can store, move, and call arbitrary callable objects, given a call signature.
//  Recommended practice: Implementations should avoid the use of dynamically allocated memory for a small contained value.
// [Note 1: Such small-object optimization can only be applied to a type T for which is_nothrow_move_constructible_- v<T> is true.
// 22.10.17.4.3 Constructors, assignment, and destructor [func.wrap.move.ctor]
template<class VT>
static constexpr bool is_callable_from = see_below;
move_only_function() noexcept;
move_only_function(nullptr_t) noexcept;
// Postconditions: *this has no target object. move_only_function(move_only_function&& f) noexcept;
// Postconditions: The target object of *this is the target object f had before construction, and f is in a valid state with an unspecified value.
template<class F> move_only_function(F&& f);
// Let VT be decay_t<F>.
// Constraints:— remove_cvref_t<F> is not the same type as move_only_function, and — remove_cvref_t<F> is not a specialization of in_place_type_t, and — is-callable-from <VT> is true.
// Mandates: is_constructible_v<VT, F> is true.
// Preconditions: VT meets the Cpp17Destructible requirements, and if is_move_constructible_v<VT> is true, VT meets the Cpp17MoveConstructible requirements. Postconditions: *this has no target object if any of the following hold:
// — f is a null function pointer value, or
// — f is a null member pointer value, or
// — remove_cvref_t<F> is a specialization of the move_only_function class template, and f has no target object.
// Otherwise, *this has a target object of type VT direct-non-list-initialized with std::forward<F>(f). Throws: Any exception thrown by the initialization of the target object. May throw bad_alloc unless VT is a function pointer or a specialization of reference_wrapper. template<class T, class... Args>
explicit move_only_function(in_place_type_t<T>, Args&&... args);
// Let VT be decay_t<T>. Constraints:
// — is_constructible_v<VT, Args...> is true, and
// — is-callable-from <VT> is true. Mandates: VT is the same type as T.
// Preconditions: VT meets the Cpp17Destructible requirements, and if is_move_constructible_v<VT> is true, VT meets the Cpp17MoveConstructible requirements.
// Postconditions: *this has a target object of type VT direct-non-list-initialized with std::forward<Args> (args)....
// Throws: Any exception thrown by the initialization of the target object. May throw bad_alloc unless VT is a function pointer or a specialization of reference_wrapper.
template<class T, class U, class... Args>
explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
// Let VT be decay_t<T>. Constraints:
// — is_constructible_v<VT, initializer_list<U>&, ArgTypes...> is true, and
// — is-callable-from <VT> is true. Mandates: VT is the same type as T.
// Preconditions: VT meets the Cpp17Destructible requirements, and if is_move_constructible_v<VT> is true, VT meets the Cpp17MoveConstructible requirements.
// Postconditions: *this has a target object of type VT direct-non-list-initialized with ilist, std::for- ward<ArgTypes>(args)....
// Throws: Any exception thrown by the initialization of the target object. May throw bad_alloc unless VT is a function pointer or a specialization of reference_wrapper.
move_only_function& operator=(move_only_function&& f);
// Effects: Equivalent to: move_only_function(std::move(f)).swap(*this); // Returns: *this.
move_only_function& operator=(nullptr_t) noexcept;
// Effects: Destroys the target object of *this, if any. Returns: *this.
template<class F> move_only_function& operator=(F&& f);
// Effects: Equivalent to: move_only_function(std::forward<F>(f)).swap(*this); Returns: *this.
~move_only_function();
// Effects: Destroys the target object of *this, if any.
// 22.10.17.4.4 Invocation [func.wrap.move.inv]
explicit operator bool() const noexcept;
// Returns: true if *this has a target object, otherwise false.
R operator()(ArgTypes... args) cv ref noexcept(noex );
// Preconditions: *this has a target object.
// Effects: Equivalent to:
return INVOKE<R>(static_cast<F inv-quals>(f), std::forward<ArgTypes>(args)...);
// where f is an lvalue designating the target object of *this and F is the type of f.
// 22.10.17.4.5 Utility [func.wrap.move.util]
void swap(move_only_function& other) noexcept;
// Effects: Exchanges the target objects of *this and other.
friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
// Effects: Equivalent to f1.swap(f2).
friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
// Returns: true if f has no target object, otherwise false.
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}
```

## 編纂・実行結果(compile and go)

```ubuntu:bash
$ clang++ p756.cpp -std=03 -o p756l -I. -Wall
In file included from p756.cpp:10:
In file included from ./N4910.h:11:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
 ^
p756.cpp:22:19: error: exception specification of overriding function is more lax than base version
      const char* what() const noexcept override;
                  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/exception.h:75:5: note: overridden virtual function is here
    what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
    ^
p756.cpp:22:31: error: expected ';' at end of declaration list
      const char* what() const noexcept override;
                              ^
                              ;
p756.cpp:25:26: error: expected function body after function declarator
const char* what() const noexcept override; 
                         ^
p756.cpp:30:28: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
    template<class R, class... ArgTypes>
                           ^
p756.cpp:33:27: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
      using result_type = R;
                          ^
p756.cpp:36:29: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
function& operator=(function&&);
                            ^
p756.cpp:37:21: error: unknown type name 'nullptr_t'
function& operator=(nullptr_t) noexcept;
                    ^
p756.cpp:37:31: error: expected ';' at end of declaration list
function& operator=(nullptr_t) noexcept;
                              ^
                              ;
p756.cpp:38:40: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template<class F> function& operator=(F&&);
                                       ^
p756.cpp:39:39: error: no template named 'reference_wrapper'
template<class F> function& operator=(reference_wrapper<F>) noexcept;
                                      ^
p756.cpp:39:60: error: expected ';' at end of declaration list
template<class F> function& operator=(reference_wrapper<F>) noexcept;
                                                           ^
                                                           ;
p756.cpp:42:21: error: expected ';' at end of declaration list
void swap(function&) noexcept;
                    ^
                    ;
p756.cpp:46:1: warning: explicit conversion functions are a C++11 extension [-Wc++11-extensions]
explicit operator bool() const noexcept;
^~~~~~~~
p756.cpp:46:31: error: expected ';' at end of declaration list
explicit operator bool() const noexcept;
                              ^
                              ;
p756.cpp:49:37: error: expected ';' at end of declaration list
const type_info& target_type() const noexcept; 
                                    ^
                                    ;
p756.cpp:50:30: error: expected ';' at end of declaration list
template<class T> T* target() noexcept; 
                             ^
                             ;
p756.cpp:51:42: error: expected ';' at end of declaration list
template<class T> const T* target() const noexcept;
                                         ^
                                         ;
p756.cpp:53:31: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
       template<class R, class... ArgTypes>
                              ^
p756.cpp:54:10: error: C++ requires a type specifier for all declarations
         function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
         ^
p756.cpp:54:37: error: expected ';' at end of declaration
         function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
                                    ^
                                    ;
p756.cpp:54:38: error: cannot use arrow operator on a type
         function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
                                     ^
p756.cpp:55:19: error: use of class template 'function' requires template arguments
template<class F> function(F) -> function<see_below>; }
                  ^
p756.cpp:29:27: note: template is declared here
    template<class> class function;
    ~~~~~~~~~~~~~~~       ^
p756.cpp:55:28: warning: variable templates are a C++14 extension [-Wc++14-extensions]
template<class F> function(F) -> function<see_below>; }
                           ^
p756.cpp:55:30: error: expected ';' at end of declaration
template<class F> function(F) -> function<see_below>; }
                             ^
                             ;
p756.cpp:55:31: error: cannot use arrow operator on a type
template<class F> function(F) -> function<see_below>; }
                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
$ clang++ p756.cpp -std=2b -o p756l -I. -Wall
p756.cpp:25:35: error: 'override' specifier is not allowed outside a class definition
const char* what() const noexcept override; 
                                  ^~~~~~~~
p756.cpp:25:20: error: non-member function cannot have 'const' qualifier
const char* what() const noexcept override; 
                   ^~~~~~
p756.cpp:55:43: error: use of undeclared identifier 'see_below'
template<class F> function(F) -> function<see_below>; }
                                          ^
p756.cpp:61:4: error: deduction guide must be declared in the same scope as template 'std::function'
   function() noexcept;
   ^
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:61:4: error: deduction guide declaration without trailing return type
   function() noexcept;
   ^
p756.cpp:63:16: error: use of class template 'function' requires template arguments; argument deduction not allowed in function prototype
function(const function& f);
               ^~~~~~~~
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:63:1: error: deduction guide must be declared in the same scope as template 'std::function'
function(const function& f);
^
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:63:1: error: deduction guide declaration without trailing return type
function(const function& f);
^
p756.cpp:67:10: error: use of class template 'function' requires template arguments; argument deduction not allowed in function prototype
function(function&& f) noexcept;
         ^~~~~~~~
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:67:1: error: deduction guide must be declared in the same scope as template 'std::function'
function(function&& f) noexcept;
^
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:67:1: error: deduction guide declaration without trailing return type
function(function&& f) noexcept;
^
p756.cpp:70:19: error: deduction guide must be declared in the same scope as template 'std::function'
template<class F> function(F&& f);
                  ^
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:70:19: error: deduction guide declaration without trailing return type
template<class F> function(F&& f);
                  ^
p756.cpp:84:43: error: use of undeclared identifier 'see_below'
template<class F> function(F) -> function<see_below>;
                                          ^
p756.cpp:84:19: error: deduction guide must be declared in the same scope as template 'std::function'
template<class F> function(F) -> function<see_below>;
                  ^
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:90:14: error: no viable constructor or deduction guide for deduction of template arguments of 'function'
    function g = [&](double) { return i; };
             ^
p756.cpp:29:27: note: candidate template ignored: could not match 'function<type-parameter-0-0>' against '(lambda at p756.cpp:90:18)'
    template<class> class function;
                          ^
p756.cpp:54:10: note: candidate template ignored: could not match 'R (*)(ArgTypes...)' against '(lambda at p756.cpp:90:18)'
         function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
         ^
p756.cpp:93:27: error: use of class template 'function' requires template arguments; argument deduction not allowed in function prototype
function& operator=(const function& f);
                          ^~~~~~~~
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:93:1: error: use of class template 'function' requires template arguments; argument deduction not allowed in function return type
function& operator=(const function& f);
^~~~~~~~
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
p756.cpp:95:21: error: use of class template 'function' requires template arguments; argument deduction not allowed in function prototype
function& operator=(function&& f);
                    ^~~~~~~~
p756.cpp:29:27: note: template is declared here
    template<class> class function;
                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p756.cpp -std=03 -o p756g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p756.cpp:10:
/usr/local/include/c++/12.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   32 | #error This file requires compiler and library support \
      |  ^~~~~
p756.cpp:22:32: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   22 |       const char* what() const noexcept override;
      |                                ^~~~~~~~
p756.cpp:174:8: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
  174 | static constexpr bool is-callable-from = see_below ; // exposition only
      |        ^~~~~~~~~
p756.cpp:22:26: error: expected ';' at end of member declaration
   22 |       const char* what() const noexcept override;
      |                          ^~~~~
      |                               ;
p756.cpp:22:32: error: 'noexcept' does not name a type
   22 |       const char* what() const noexcept override;
      |                                ^~~~~~~~
p756.cpp:22:32: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p756.cpp:22:19: error: looser exception specification on overriding virtual function 'virtual const char* std::bad_function_call::what() const'
   22 |       const char* what() const noexcept override;
      |                   ^~~~
In file included from /usr/local/include/c++/12.1.0/exception:38,
                 from /usr/local/include/c++/12.1.0/ios:39,
                 from /usr/local/include/c++/12.1.0/ostream:38,
                 from /usr/local/include/c++/12.1.0/iostream:39,
                 from N4910.h:2:
/usr/local/include/c++/12.1.0/bits/exception.h:76:5: note: overridden function is 'virtual const char* std::exception::what() const throw ()'
   76 |     what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
      |     ^~~~
p756.cpp:25:26: error: expected initializer before 'noexcept'
   25 | const char* what() const noexcept override;
      |                          ^~~~~~~~
p756.cpp:30:28: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   30 |     template<class R, class... ArgTypes>
      |                            ^~~
p756.cpp:31:30: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   31 |     class function<R(ArgTypes...)> {
      |                              ^~~
p756.cpp:33:13: error: expected nested-name-specifier before 'result_type'
   33 |       using result_type = R;
      |             ^~~~~~~~~~~
p756.cpp:36:29: error: expected ',' or '...' before '&&' token
   36 | function& operator=(function&&);
      |                             ^~
p756.cpp:37:21: error: 'nullptr_t' has not been declared
   37 | function& operator=(nullptr_t) noexcept;
      |                     ^~~~~~~~~
p756.cpp:37:30: error: expected ';' at end of member declaration
   37 | function& operator=(nullptr_t) noexcept;
      |                              ^
      |                               ;
p756.cpp:37:32: error: 'noexcept' does not name a type
   37 | function& operator=(nullptr_t) noexcept;
      |                                ^~~~~~~~
p756.cpp:37:32: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p756.cpp:38:40: error: expected ',' or '...' before '&&' token
   38 | template<class F> function& operator=(F&&);
      |                                        ^~
p756.cpp:39:39: error: 'reference_wrapper' has not been declared
   39 | template<class F> function& operator=(reference_wrapper<F>) noexcept;
      |                                       ^~~~~~~~~~~~~~~~~
p756.cpp:39:56: error: expected ',' or '...' before '<' token
   39 | template<class F> function& operator=(reference_wrapper<F>) noexcept;
      |                                                        ^
p756.cpp:39:61: error: expected initializer before 'noexcept'
   39 | template<class F> function& operator=(reference_wrapper<F>) noexcept;
      |                                                             ^~~~~~~~
p756.cpp:42:20: error: expected ';' at end of member declaration
   42 | void swap(function&) noexcept;
      |                    ^
      |                     ;
p756.cpp:42:22: error: 'noexcept' does not name a type
   42 | void swap(function&) noexcept;
      |                      ^~~~~~~~
p756.cpp:42:22: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p756.cpp:46:26: warning: explicit conversion operators only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   46 | explicit operator bool() const noexcept;
      |                          ^~~~~
p756.cpp:46:26: error: expected ';' at end of member declaration
   46 | explicit operator bool() const noexcept;
      |                          ^~~~~
      |                               ;
p756.cpp:46:32: error: 'noexcept' does not name a type
   46 | explicit operator bool() const noexcept;
      |                                ^~~~~~~~
p756.cpp:46:32: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p756.cpp:49:32: error: expected ';' at end of member declaration
   49 | const type_info& target_type() const noexcept;
      |                                ^~~~~
      |                                     ;
p756.cpp:49:38: error: 'noexcept' does not name a type
   49 | const type_info& target_type() const noexcept;
      |                                      ^~~~~~~~
p756.cpp:49:38: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p756.cpp:50:31: error: expected initializer before 'noexcept'
   50 | template<class T> T* target() noexcept;
      |                               ^~~~~~~~
p756.cpp:51:43: error: expected initializer before 'noexcept'
   51 | template<class T> const T* target() const noexcept;
      |                                           ^~~~~~~~
p756.cpp:53:31: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   53 |        template<class R, class... ArgTypes>
      |                               ^~~
p756.cpp:54:32: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   54 |          function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
      |                                ^~~
p756.cpp:54:60: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   54 |          function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
      |                                                            ^~~
p756.cpp:54:65: error: expected constructor, destructor, or type conversion before ';' token
   54 |          function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
      |                                                                 ^
p756.cpp:55:43: error: 'see_below' was not declared in this scope
   55 | template<class F> function(F) -> function<see_below>; }
      |                                           ^~~~~~~~~
p756.cpp:55:52: error: template argument 1 is invalid
   55 | template<class F> function(F) -> function<see_below>; }
      |                                                    ^
p756.cpp:55:53: error: expected constructor, destructor, or type conversion before ';' token
   55 | template<class F> function(F) -> function<see_below>; }
      |                                                     ^
p756.cpp:61:15: error: expected constructor, destructor, or type conversion before 'noexcept'
   61 |    function() noexcept;
      |               ^~~~~~~~
p756.cpp:63:16: error: invalid use of template-name 'std::function' without an argument list
   63 | function(const function& f);
      |                ^~~~~~~~
p756.cpp:63:16: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++1'
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:63:28: error: expected constructor, destructor, or type conversion before ';' token
   63 | function(const function& f);
      |                            ^
p756.cpp:67:9: error: expected constructor, destructor, or type conversion before '(' token
   67 | function(function&& f) noexcept;
      |         ^
p756.cpp:70:29: error: expected ',' or '...' before '&&' token
   70 | template<class F> function(F&& f);
      |                             ^~
p756.cpp:70:34: error: expected constructor, destructor, or type conversion before ';' token
   70 | template<class F> function(F&& f);
      |                                  ^
p756.cpp:84:43: error: 'see_below' was not declared in this scope
   84 | template<class F> function(F) -> function<see_below>;
      |                                           ^~~~~~~~~
p756.cpp:84:52: error: template argument 1 is invalid
   84 | template<class F> function(F) -> function<see_below>;
      |                                                    ^
p756.cpp:84:53: error: expected constructor, destructor, or type conversion before ';' token
   84 | template<class F> function(F) -> function<see_below>;
      |                                                     ^
p756.cpp: In function 'void f()':
p756.cpp:89:10: warning: extended initializer lists only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   89 |     int i{5};
      |          ^
p756.cpp:90:14: error: missing template arguments before 'g'
   90 |     function g = [&](double) { return i; };
      |              ^
p756.cpp:89:9: warning: unused variable 'i' [-Wunused-variable]
   89 |     int i{5};
      |         ^
p756.cpp: At global scope:
p756.cpp:93:1: error: invalid use of template-name 'std::function' without an argument list
   93 | function& operator=(const function& f);
      | ^~~~~~~~
p756.cpp:93:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:95:1: error: invalid use of template-name 'std::function' without an argument list
   95 | function& operator=(function&& f);
      | ^~~~~~~~
p756.cpp:95:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:97:1: error: invalid use of template-name 'std::function' without an argument list
   97 | function& operator=(nullptr_t) noexcept;
      | ^~~~~~~~
p756.cpp:97:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:100:19: error: invalid use of template-name 'std::function' without an argument list
  100 | template<class F> function& operator=(F&& f);
      |                   ^~~~~~~~
p756.cpp:100:19: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:103:19: error: invalid use of template-name 'std::function' without an argument list
  103 | template<class F> function& operator=(reference_wrapper<F> f) noexcept;
      |                   ^~~~~~~~
p756.cpp:103:19: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:105:10: error: expected class-name before '(' token
  105 | ~function();
      |          ^
p756.cpp:112:19: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  112 |     template<class... S> class move_only_function;
      |                   ^~~
p756.cpp:113:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  113 | template<class R, class... ArgTypes>
      |                        ^~~
p756.cpp:114:36: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  114 | class move_only_function<R(ArgTypes...) cv ref public:
      |                                    ^~~
p756.cpp:114:39: error: a function call cannot appear in a constant-expression
  114 | class move_only_function<R(ArgTypes...) cv ref public:
      |                                       ^
p756.cpp:115:27: error: template argument 1 is invalid
  115 |       using result_type = R;
      |                           ^
p756.cpp:117:9: error: variable or field 'swap' declared void
  117 |    void swap(function& other) noexcept;
      |         ^~~~
p756.cpp:117:22: error: missing template arguments before '&' token
  117 |    void swap(function& other) noexcept;
      |                      ^
p756.cpp:117:24: error: 'other' was not declared in this scope
  117 |    void swap(function& other) noexcept;
      |                        ^~~~~
p756.cpp:121:32: error: expected initializer before 'noexcept'
  121 | explicit operator bool() const noexcept;
      |                                ^~~~~~~~
p756.cpp:124:1: error: 'R' does not name a type
  124 | R operator()(ArgTypes... args) const;
      | ^
p756.cpp:128:38: error: expected initializer before 'noexcept'
  128 | const type_info& target_type() const noexcept;
      |                                      ^~~~~~~~
p756.cpp:130:31: error: expected initializer before 'noexcept'
  130 | template<class T> T* target() noexcept;
      |                               ^~~~~~~~
p756.cpp:131:43: error: expected initializer before 'noexcept'
  131 | template<class T> const T* target() const noexcept;
      |                                           ^~~~~~~~
p756.cpp:134:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  134 | template<class R, class... ArgTypes>
      |                        ^~~
p756.cpp:135:44: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  135 |   bool operator==(const function<R(ArgTypes...)>& f, nullptr_t) noexcept;
      |                                            ^~~
p756.cpp:135:54: error: 'nullptr_t' has not been declared
  135 |   bool operator==(const function<R(ArgTypes...)>& f, nullptr_t) noexcept;
      |                                                      ^~~~~~~~~
p756.cpp:135:65: error: expected initializer before 'noexcept'
  135 |   bool operator==(const function<R(ArgTypes...)>& f, nullptr_t) noexcept;
      |                                                                 ^~~~~~~~
p756.cpp:138:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  138 | template<class R, class... ArgTypes>
      |                        ^~~
p756.cpp:139:32: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  139 |   void swap(function<R(ArgTypes...)>& f1, function<R(ArgTypes...)>& f2) noexcept;
      |                                ^~~
p756.cpp:139:62: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  139 |   void swap(function<R(ArgTypes...)>& f1, function<R(ArgTypes...)>& f2) noexcept;
      |                                                              ^~~
p756.cpp:139:73: error: expected initializer before 'noexcept'
  139 |   void swap(function<R(ArgTypes...)>& f1, function<R(ArgTypes...)>& f2) noexcept;
      |                                                                         ^~~~~~~~
p756.cpp:148:15: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  148 | template<class... S> class move_only_function;
      |               ^~~
p756.cpp:149:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  149 | template<class R, class... ArgTypes>
      |                        ^~~
p756.cpp:150:36: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  150 | class move_only_function<R(ArgTypes...) cv ref public:
      |                                    ^~~
p756.cpp:150:39: error: a function call cannot appear in a constant-expression
  150 | class move_only_function<R(ArgTypes...) cv ref public:
      |                                       ^
p756.cpp:151:27: error: template argument 1 is invalid
  151 |       using result_type = R;
      |                           ^
p756.cpp:153:22: error: expected constructor, destructor, or type conversion before 'noexcept'
  153 | move_only_function() noexcept;
      |                      ^~~~~~~~
p756.cpp:154:19: error: expected constructor, destructor, or type conversion before '(' token
  154 | move_only_function(nullptr_t) noexcept;
      |                   ^
p756.cpp:155:19: error: expected constructor, destructor, or type conversion before '(' token
  155 | move_only_function(move_only_function&&) noexcept;
      |                   ^
p756.cpp:156:39: error: expected ',' or '...' before '&&' token
  156 | template<class F> move_only_function(F&&);
      |                                       ^~
p756.cpp:156:42: error: expected constructor, destructor, or type conversion before ';' token
  156 | template<class F> move_only_function(F&&);
      |                                          ^
p756.cpp:157:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  157 | template<class T, class... Args>
      |                        ^~~
p756.cpp:158:13: error: ISO C++ forbids declaration of 'move_only_function' with no type [-fpermissive]
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |             ^~~~~~~~~~~~~~~~~~
p756.cpp:158:4: error: 'explicit' outside class declaration
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |    ^~~~~~~~
p756.cpp:158:13: error: conflicting declaration of template 'template<class T, class ... Args> int std::std::move_only_function'
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |             ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: previous declaration 'template<class ... S> class std::std::move_only_function'
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:158:32: error: 'in_place_type_t' was not declared in this scope
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |                                ^~~~~~~~~~~~~~~
p756.cpp:158:49: error: expected primary-expression before '>' token
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |                                                 ^
p756.cpp:158:50: error: expected primary-expression before ',' token
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |                                                  ^
p756.cpp:158:56: error: expected primary-expression before '&&' token
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |                                                        ^~
p756.cpp:159:33: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  159 | template<class T, class U, class... Args>
      |                                 ^~~
p756.cpp:160:21: error: ISO C++ forbids declaration of 'move_only_function' with no type [-fpermissive]
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                     ^~~~~~~~~~~~~~~~~~
p756.cpp:160:12: error: 'explicit' outside class declaration
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |            ^~~~~~~~
p756.cpp:160:21: error: conflicting declaration of template 'template<class T, class U, class ... Args> int std::std::move_only_function'
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                     ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: previous declaration 'template<class ... S> class std::std::move_only_function'
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:160:40: error: 'in_place_type_t' was not declared in this scope
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                                        ^~~~~~~~~~~~~~~
p756.cpp:160:57: error: expected primary-expression before '>' token
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                                                         ^
p756.cpp:160:58: error: expected primary-expression before ',' token
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                                                          ^
p756.cpp:160:60: error: 'initializer_list' was not declared in this scope; did you mean 'uninitialized_fill'?
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                                                            ^~~~~~~~~~~~~~~~
      |                                                            uninitialized_fill
p756.cpp:160:78: error: expected primary-expression before '>' token
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                                                                              ^
p756.cpp:160:79: error: expected primary-expression before ',' token
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                                                                               ^
p756.cpp:160:85: error: expected primary-expression before '&&' token
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                                                                                     ^~
p756.cpp:161:1: error: invalid use of template-name 'std::std::move_only_function' without an argument list
  161 | move_only_function& operator=(move_only_function&&);
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:161:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++1'
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:162:10: error: invalid use of template-name 'std::std::move_only_function' without an argument list
  162 |          move_only_function& operator=(nullptr_t) noexcept;
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:162:10: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:163:28: error: invalid use of template-name 'std::std::move_only_function' without an argument list
  163 |          template<class F> move_only_function& operator=(F&&);
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:163:28: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:164:20: error: expected class-name before '(' token
  164 | ~move_only_function();
      |                    ^
p756.cpp:166:32: error: expected initializer before 'noexcept'
  166 | explicit operator bool() const noexcept;
      |                                ^~~~~~~~
p756.cpp:167:1: error: 'R' does not name a type
  167 | R operator()(ArgTypes...) cv ref noexcept(noex );
      | ^
p756.cpp:169:6: error: variable or field 'swap' declared void
  169 | void swap(move_only_function&) noexcept;
      |      ^~~~
p756.cpp:169:29: error: missing template arguments before '&' token
  169 | void swap(move_only_function&) noexcept;
      |                             ^
p756.cpp:169:30: error: expected primary-expression before ')' token
  169 | void swap(move_only_function&) noexcept;
      |                              ^
p756.cpp:170:1: error: 'friend' used outside of class
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      | ^~~~~~
      | ------
p756.cpp:170:13: error: variable or field 'swap' declared void
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      |             ^~~~
p756.cpp:170:36: error: missing template arguments before '&' token
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      |                                    ^
p756.cpp:170:37: error: expected primary-expression before ',' token
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      |                                     ^
p756.cpp:170:57: error: missing template arguments before '&' token
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      |                                                         ^
p756.cpp:170:58: error: expected primary-expression before ')' token
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      |                                                          ^
p756.cpp:171:1: error: 'friend' used outside of class
  171 | friend bool operator==(const move_only_function&, nullptr_t) noexcept;
      | ^~~~~~
      | ------
p756.cpp:171:30: error: invalid use of template-name 'std::std::move_only_function' without an argument list
  171 | friend bool operator==(const move_only_function&, nullptr_t) noexcept;
      |                              ^~~~~~~~~~~~~~~~~~
p756.cpp:171:30: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:171:51: error: 'nullptr_t' has not been declared
  171 | friend bool operator==(const move_only_function&, nullptr_t) noexcept;
      |                                                   ^~~~~~~~~
p756.cpp:171:62: error: expected initializer before 'noexcept'
  171 | friend bool operator==(const move_only_function&, nullptr_t) noexcept;
      |                                                              ^~~~~~~~
p756.cpp:172:8: error: expected unqualified-id before 'private'
  172 |        private:
      |        ^~~~~~~
p756.cpp:182:8: error: 'constexpr' does not name a type
  182 | static constexpr bool is_callable_from = see_below;
      |        ^~~~~~~~~
p756.cpp:182:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p756.cpp:183:22: error: expected constructor, destructor, or type conversion before 'noexcept'
  183 | move_only_function() noexcept;
      |                      ^~~~~~~~
p756.cpp:184:19: error: expected constructor, destructor, or type conversion before '(' token
  184 | move_only_function(nullptr_t) noexcept;
      |                   ^
p756.cpp:187:39: error: expected ',' or '...' before '&&' token
  187 | template<class F> move_only_function(F&& f);
      |                                       ^~
p756.cpp:187:44: error: expected constructor, destructor, or type conversion before ';' token
  187 | template<class F> move_only_function(F&& f);
      |                                            ^
p756.cpp:196:10: error: ISO C++ forbids declaration of 'move_only_function' with no type [-fpermissive]
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:196:1: error: 'explicit' outside class declaration
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      | ^~~~~~~~
p756.cpp:196:29: error: 'in_place_type_t' was not declared in this scope
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                             ^~~~~~~~~~~~~~~
p756.cpp:196:45: error: 'T' was not declared in this scope
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                             ^
p756.cpp:196:47: error: expected primary-expression before ',' token
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                               ^
p756.cpp:196:49: error: 'Args' was not declared in this scope
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                                 ^~~~
p756.cpp:196:63: error: expression list treated as compound expression in initializer [-fpermissive]
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                                               ^
p756.cpp:203:33: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  203 | template<class T, class U, class... Args>
      |                                 ^~~
p756.cpp:204:12: error: ISO C++ forbids declaration of 'move_only_function' with no type [-fpermissive]
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |            ^~~~~~~~~~~~~~~~~~
p756.cpp:204:3: error: 'explicit' outside class declaration
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |   ^~~~~~~~
p756.cpp:204:31: error: 'template<class T, class U, class ... Args> int move_only_function' redeclared as different kind of entity
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                               ^~~~~~~~~~~~~~~
p756.cpp:196:10: note: previous declaration 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:204:31: error: 'in_place_type_t' was not declared in this scope
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                               ^~~~~~~~~~~~~~~
p756.cpp:204:48: error: expected primary-expression before '>' token
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                                                ^
p756.cpp:204:49: error: expected primary-expression before ',' token
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                                                 ^
p756.cpp:204:51: error: 'initializer_list' was not declared in this scope
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                                                   ^~~~~~~~~~~~~~~~
p756.cpp:204:69: error: expected primary-expression before '>' token
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                                                                     ^
p756.cpp:204:71: error: 'ilist' was not declared in this scope; did you mean 'va_list'?
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                                                                       ^~~~~
      |                                                                       va_list
p756.cpp:204:82: error: expected primary-expression before '&&' token
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |                                                                                  ^~
p756.cpp:211:1: error: reference to 'move_only_function' is ambiguous
  211 | move_only_function& operator=(move_only_function&& f);
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: candidates are: 'template<class ... S> class std::move_only_function'
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:10: note:                 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:213:1: error: reference to 'move_only_function' is ambiguous
  213 | move_only_function& operator=(nullptr_t) noexcept;
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: candidates are: 'template<class ... S> class std::move_only_function'
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:10: note:                 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:215:19: error: reference to 'move_only_function' is ambiguous
  215 | template<class F> move_only_function& operator=(F&& f);
      |                   ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: candidates are: 'template<class ... S> class std::move_only_function'
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:10: note:                 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:217:20: error: expected class-name before '(' token
  217 | ~move_only_function();
      |                    ^
p756.cpp:220:32: error: expected initializer before 'noexcept'
  220 | explicit operator bool() const noexcept;
      |                                ^~~~~~~~
p756.cpp:222:1: error: 'R' does not name a type
  222 | R operator()(ArgTypes... args) cv ref noexcept(noex );
      | ^
p756.cpp:225:1: error: expected unqualified-id before 'return'
  225 | return INVOKE<R>(static_cast<F inv-quals>(f), std::forward<ArgTypes>(args)...);
      | ^~~~~~
p756.cpp:228:6: error: variable or field 'swap' declared void
  228 | void swap(move_only_function& other) noexcept;
      |      ^~~~
p756.cpp:228:11: error: reference to 'move_only_function' is ambiguous
  228 | void swap(move_only_function& other) noexcept;
      |           ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: candidates are: 'template<class ... S> class std::move_only_function'
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:10: note:                 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:228:31: error: 'other' was not declared in this scope
  228 | void swap(move_only_function& other) noexcept;
      |                               ^~~~~
p756.cpp:230:1: error: 'friend' used outside of class
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      | ^~~~~~
      | ------
p756.cpp:230:13: error: variable or field 'swap' declared void
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |             ^~~~
p756.cpp:230:18: error: reference to 'move_only_function' is ambiguous
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |                  ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: candidates are: 'template<class ... S> class std::move_only_function'
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:10: note:                 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:230:38: error: 'f1' was not declared in this scope; did you mean 'y1'?
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |                                      ^~
      |                                      y1
p756.cpp:230:42: error: reference to 'move_only_function' is ambiguous
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |                                          ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: candidates are: 'template<class ... S> class std::move_only_function'
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:10: note:                 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:230:62: error: 'f2' was not declared in this scope; did you mean 'f'?
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |                                                              ^~
      |                                                              f
p756.cpp:232:1: error: 'friend' used outside of class
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      | ^~~~~~
      | ------
p756.cpp:232:30: error: reference to 'move_only_function' is ambiguous
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      |                              ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: candidates are: 'template<class ... S> class std::move_only_function'
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:10: note:                 'int move_only_function'
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:232:53: error: 'nullptr_t' has not been declared
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      |                                                     ^~~~~~~~~
p756.cpp:232:64: error: expected initializer before 'noexcept'
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      |                                                                ^~~~~~~~

$ g++ p756.cpp -std=2b -o p756g -I. -Wall
p756.cpp:25:35: error: virt-specifiers in 'what' not allowed outside a class definition
   25 | const char* what() const noexcept override;
      |                                   ^~~~~~~~
p756.cpp:25:35: error: non-member function 'const char* what()' cannot have cv-qualifier
p756.cpp:55:43: error: 'see_below' was not declared in this scope
   55 | template<class F> function(F) -> function<see_below>; }
      |                                           ^~~~~~~~~
p756.cpp:55:52: error: template argument 1 is invalid
   55 | template<class F> function(F) -> function<see_below>; }
      |                                                    ^
p756.cpp:55:34: error: trailing return type '<type error>' of deduction guide is not a specialization of 'std::function< <template-parameter-1-1> >'
   55 | template<class F> function(F) -> function<see_below>; }
      |                                  ^~~~~~~~~~~~~~~~~~~
p756.cpp:61:4: error: deduction guide for 'std::function< <template-parameter-1-1> >' must have trailing return type
   61 |    function() noexcept;
      |    ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:63:10: error: template placeholder type 'const function<...auto...>' must be followed by a simple declarator-id
   63 | function(const function& f);
      |          ^~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:63:1: error: deduction guide for 'std::function< <template-parameter-1-1> >' must have trailing return type
   63 | function(const function& f);
      | ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:67:10: error: template placeholder type 'function<...auto...>' must be followed by a simple declarator-id
   67 | function(function&& f) noexcept;
      |          ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:67:1: error: deduction guide for 'std::function< <template-parameter-1-1> >' must have trailing return type
   67 | function(function&& f) noexcept;
      | ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:70:19: error: deduction guide for 'std::function< <template-parameter-1-1> >' must have trailing return type
   70 | template<class F> function(F&& f);
      |                   ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:84:43: error: 'see_below' was not declared in this scope
   84 | template<class F> function(F) -> function<see_below>;
      |                                           ^~~~~~~~~
p756.cpp:84:52: error: template argument 1 is invalid
   84 | template<class F> function(F) -> function<see_below>;
      |                                                    ^
p756.cpp:84:34: error: trailing return type '<type error>' of deduction guide is not a specialization of 'std::function< <template-parameter-1-1> >'
   84 | template<class F> function(F) -> function<see_below>;
      |                                  ^~~~~~~~~~~~~~~~~~~
p756.cpp: In function 'void f()':
p756.cpp:90:42: error: class template argument deduction failed:
   90 |     function g = [&](double) { return i; };
      |                                          ^
p756.cpp:90:42: error: no matching function for call to 'function(f()::<lambda(double)>)'
p756.cpp:29:27: note: candidate: 'template<class> function()-> std::function< <template-parameter-1-1> >'
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:29:27: note:   template argument deduction/substitution failed:
p756.cpp:90:42: note:   candidate expects 0 arguments, 1 provided
   90 |     function g = [&](double) { return i; };
      |                                          ^
p756.cpp:29:27: note: candidate: 'template<class> function(std::function< <template-parameter-1-1> >)-> std::function< <template-parameter-1-1> >'
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:29:27: note:   template argument deduction/substitution failed:
p756.cpp:90:42: note:   'f()::<lambda(double)>' is not derived from 'std::function< <template-parameter-1-1> >'
   90 |     function g = [&](double) { return i; };
      |                                          ^
p756.cpp:54:10: note: candidate: 'template<class R, class ... ArgTypes> std::function(R (*)(ArgTypes ...))-> function<R(ArgTypes ...)>'
   54 |          function(R(*)(ArgTypes...)) -> function<R(ArgTypes...)>;
      |          ^~~~~~~~
p756.cpp:54:10: note:   template argument deduction/substitution failed:
p756.cpp:90:42: note:   mismatched types 'R (*)(ArgTypes ...)' and 'f()::<lambda(double)>'
   90 |     function g = [&](double) { return i; };
      |                                          ^
p756.cpp: At global scope:
p756.cpp:93:21: error: template placeholder type 'const function<...auto...>' must be followed by a simple declarator-id
   93 | function& operator=(const function& f);
      |                     ^~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:93:1: error: deduced class type 'function' in function return type
   93 | function& operator=(const function& f);
      | ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:95:21: error: template placeholder type 'function<...auto...>' must be followed by a simple declarator-id
   95 | function& operator=(function&& f);
      |                     ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:95:1: error: deduced class type 'function' in function return type
   95 | function& operator=(function&& f);
      | ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:97:1: error: deduced class type 'function' in function return type
   97 | function& operator=(nullptr_t) noexcept;
      | ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:100:19: error: deduced class type 'function' in function return type
  100 | template<class F> function& operator=(F&& f);
      |                   ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:103:19: error: deduced class type 'function' in function return type
  103 | template<class F> function& operator=(reference_wrapper<F> f) noexcept;
      |                   ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:105:10: error: expected class-name before '(' token
  105 | ~function();
      |          ^
p756.cpp:115:27: error: template argument 1 is invalid
  115 |       using result_type = R;
      |                           ^
p756.cpp:117:14: error: template placeholder type 'function<...auto...>' must be followed by a simple declarator-id
  117 |    void swap(function& other) noexcept;
      |              ^~~~~~~~
p756.cpp:29:27: note: 'template<class> class std::function' declared here
   29 |     template<class> class function;
      |                           ^~~~~~~~
p756.cpp:121:1: error: 'explicit' outside class declaration
  121 | explicit operator bool() const noexcept;
      | ^~~~~~~~
p756.cpp:121:32: error: non-member function 'std::operator bool()' cannot have cv-qualifier
  121 | explicit operator bool() const noexcept;
      |                                ^~~~~~~~
p756.cpp:121:10: error: 'std::operator bool()' must be a non-static member function
  121 | explicit operator bool() const noexcept;
      |          ^~~~~~~~
p756.cpp:124:1: error: 'R' does not name a type
  124 | R operator()(ArgTypes... args) const;
      | ^
p756.cpp:128:38: error: non-member function 'const std::type_info& std::target_type()' cannot have cv-qualifier
  128 | const type_info& target_type() const noexcept;
      |                                      ^~~~~~~~
p756.cpp:131:43: error: non-member function 'const T* std::target()' cannot have cv-qualifier
  131 | template<class T> const T* target() const noexcept;
      |                                           ^~~~~~~~
p756.cpp:151:27: error: template argument 1 is invalid
  151 |       using result_type = R;
      |                           ^
p756.cpp:153:1: error: deduction guide for 'std::std::move_only_function<S>' must have trailing return type
  153 | move_only_function() noexcept;
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:154:1: error: deduction guide for 'std::std::move_only_function<S>' must have trailing return type
  154 | move_only_function(nullptr_t) noexcept;
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:155:20: error: class template placeholder 'std::std::move_only_function' not permitted in this context
  155 | move_only_function(move_only_function&&) noexcept;
      |                    ^~~~~~~~~~~~~~~~~~
p756.cpp:155:20: note: use 'auto' for an abbreviated function template
p756.cpp:155:1: error: deduction guide for 'std::std::move_only_function<S>' must have trailing return type
  155 | move_only_function(move_only_function&&) noexcept;
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:156:19: error: deduction guide for 'std::std::move_only_function<S>' must have trailing return type
  156 | template<class F> move_only_function(F&&);
      |                   ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:158:13: error: deduction guide for 'std::std::move_only_function<S>' must have trailing return type
  158 |    explicit move_only_function(in_place_type_t<T>, Args&&...);
      |             ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:160:21: error: deduction guide for 'std::std::move_only_function<S>' must have trailing return type
  160 |            explicit move_only_function(in_place_type_t<T>, initializer_list<U>, Args&&...);
      |                     ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:161:31: error: class template placeholder 'std::std::move_only_function' not permitted in this context
  161 | move_only_function& operator=(move_only_function&&);
      |                               ^~~~~~~~~~~~~~~~~~
p756.cpp:161:31: note: use 'auto' for an abbreviated function template
p756.cpp:161:1: error: deduced class type 'move_only_function' in function return type
  161 | move_only_function& operator=(move_only_function&&);
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:162:10: error: deduced class type 'move_only_function' in function return type
  162 |          move_only_function& operator=(nullptr_t) noexcept;
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:163:28: error: deduced class type 'move_only_function' in function return type
  163 |          template<class F> move_only_function& operator=(F&&);
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:148:28: note: 'template<class ... S> class std::std::move_only_function' declared here
  148 | template<class... S> class move_only_function;
      |                            ^~~~~~~~~~~~~~~~~~
p756.cpp:164:20: error: expected class-name before '(' token
  164 | ~move_only_function();
      |                    ^
p756.cpp:166:1: error: 'explicit' outside class declaration
  166 | explicit operator bool() const noexcept;
      | ^~~~~~~~
p756.cpp:166:32: error: non-member function 'std::std::operator bool()' cannot have cv-qualifier
  166 | explicit operator bool() const noexcept;
      |                                ^~~~~~~~
p756.cpp:166:10: error: 'std::std::operator bool()' must be a non-static member function
  166 | explicit operator bool() const noexcept;
      |          ^~~~~~~~
p756.cpp:167:1: error: 'R' does not name a type
  167 | R operator()(ArgTypes...) cv ref noexcept(noex );
      | ^
p756.cpp:169:11: error: class template placeholder 'std::std::move_only_function' not permitted in this context
  169 | void swap(move_only_function&) noexcept;
      |           ^~~~~~~~~~~~~~~~~~
p756.cpp:169:11: note: use 'auto' for an abbreviated function template
p756.cpp:170:1: error: 'friend' used outside of class
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      | ^~~~~~
      | ------
p756.cpp:170:18: error: class template placeholder 'std::std::move_only_function' not permitted in this context
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      |                  ^~~~~~~~~~~~~~~~~~
p756.cpp:170:18: note: use 'auto' for an abbreviated function template
p756.cpp:170:39: error: class template placeholder 'std::std::move_only_function' not permitted in this context
  170 | friend void swap(move_only_function&, move_only_function&) noexcept;
      |                                       ^~~~~~~~~~~~~~~~~~
p756.cpp:170:39: note: use 'auto' for an abbreviated function template
p756.cpp:171:1: error: 'friend' used outside of class
  171 | friend bool operator==(const move_only_function&, nullptr_t) noexcept;
      | ^~~~~~
      | ------
p756.cpp:171:24: error: class template placeholder 'std::std::move_only_function' not permitted in this context
  171 | friend bool operator==(const move_only_function&, nullptr_t) noexcept;
      |                        ^~~~~
p756.cpp:171:24: note: use 'auto' for an abbreviated function template
p756.cpp:171:13: error: 'bool std::std::operator==(...)' must have an argument of class or enumerated type
  171 | friend bool operator==(const move_only_function&, nullptr_t) noexcept;
      |             ^~~~~~~~
p756.cpp:172:8: error: expected unqualified-id before 'private'
  172 |        private:
      |        ^~~~~~~
p756.cpp:182:42: error: 'see_below' was not declared in this scope
  182 | static constexpr bool is_callable_from = see_below;
      |                                          ^~~~~~~~~
p756.cpp:183:1: error: deduction guide for 'std::move_only_function<S>' must have trailing return type
  183 | move_only_function() noexcept;
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:184:1: error: deduction guide for 'std::move_only_function<S>' must have trailing return type
  184 | move_only_function(nullptr_t) noexcept;
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:187:19: error: deduction guide for 'std::move_only_function<S>' must have trailing return type
  187 | template<class F> move_only_function(F&& f);
      |                   ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:196:45: error: 'T' was not declared in this scope
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                             ^
p756.cpp:196:46: error: template argument 1 is invalid
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                              ^
p756.cpp:196:49: error: 'Args' has not been declared
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                                 ^~~~
p756.cpp:196:59: error: expansion pattern 'int&&' contains no parameter packs
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |                                                           ^~~~
p756.cpp:196:10: error: deduction guide for 'std::move_only_function<S>' must have trailing return type
  196 | explicit move_only_function(in_place_type_t<T>, Args&&... args);
      |          ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:204:12: error: deduction guide for 'std::move_only_function<S>' must have trailing return type
  204 |   explicit move_only_function(in_place_type_t<T>, initializer_list<U> ilist, Args&&... args);
      |            ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:211:31: error: template placeholder type 'move_only_function<...auto...>' must be followed by a simple declarator-id
  211 | move_only_function& operator=(move_only_function&& f);
      |                               ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:211:1: error: deduced class type 'move_only_function' in function return type
  211 | move_only_function& operator=(move_only_function&& f);
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:213:1: error: deduced class type 'move_only_function' in function return type
  213 | move_only_function& operator=(nullptr_t) noexcept;
      | ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:215:19: error: deduced class type 'move_only_function' in function return type
  215 | template<class F> move_only_function& operator=(F&& f);
      |                   ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:217:20: error: expected class-name before '(' token
  217 | ~move_only_function();
      |                    ^
p756.cpp:220:1: error: 'explicit' outside class declaration
  220 | explicit operator bool() const noexcept;
      | ^~~~~~~~
p756.cpp:220:32: error: non-member function 'operator bool()' cannot have cv-qualifier
  220 | explicit operator bool() const noexcept;
      |                                ^~~~~~~~
p756.cpp:220:10: error: 'operator bool()' must be a non-static member function
  220 | explicit operator bool() const noexcept;
      |          ^~~~~~~~
p756.cpp:222:1: error: 'R' does not name a type
  222 | R operator()(ArgTypes... args) cv ref noexcept(noex );
      | ^
p756.cpp:225:1: error: expected unqualified-id before 'return'
  225 | return INVOKE<R>(static_cast<F inv-quals>(f), std::forward<ArgTypes>(args)...);
      | ^~~~~~
p756.cpp:228:11: error: template placeholder type 'move_only_function<...auto...>' must be followed by a simple declarator-id
  228 | void swap(move_only_function& other) noexcept;
      |           ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:230:1: error: 'friend' used outside of class
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      | ^~~~~~
      | ------
p756.cpp:230:18: error: template placeholder type 'move_only_function<...auto...>' must be followed by a simple declarator-id
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |                  ^~~~~~~~~~~~~~~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:230:40: error: expected ')' before ',' token
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |                 ~                      ^
      |                                        )
p756.cpp:230:13: error: declaration of 'void swap(...)' has a different exception specifier
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |             ^~~~
p756.cpp:228:6: note: from previous declaration 'void swap(...) noexcept'
  228 | void swap(move_only_function& other) noexcept;
      |      ^~~~
p756.cpp:230:60: error: expected initializer before '&' token
  230 | friend void swap(move_only_function& f1, move_only_function& f2) noexcept;
      |                                                            ^
p756.cpp:232:1: error: 'friend' used outside of class
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      | ^~~~~~
      | ------
p756.cpp:232:24: error: template placeholder type 'const move_only_function<...auto...>' must be followed by a simple declarator-id
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      |                        ^~~~~
p756.cpp:112:32: note: 'template<class ... S> class std::move_only_function' declared here
  112 |     template<class... S> class move_only_function;
      |                                ^~~~~~~~~~~~~~~~~~
p756.cpp:232:51: error: expected ')' before ',' token
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      |                       ~                           ^
      |                                                   )
p756.cpp:232:13: error: 'bool operator==(...)' must have an argument of class or enumerated type
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      |             ^~~~~~~~
p756.cpp:232:62: error: expected initializer before ')' token
  232 | friend bool operator==(const move_only_function& f, nullptr_t) noexcept;
      |                                                              ^

```

## 検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

<!-- リンクエラーの解説をする。clang++とg++の比較。意味のある出力。
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。-->

# 参考資料(reference)


関連する自己参照以外は、こちらの先頭に移転。

C言語（C++)に対する誤解、曲解、無理解、爽快。

https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

#include "N4910.h"

https://qiita.com/kaizen_nagoya/items/163a47cef7d6bb1c33a8

C++N4910資料の改善点

https://qiita.com/kaizen_nagoya/items/fb4ceb5d117a54641af3

dockerにclang

https://qiita.com/kaizen_nagoya/items/8829ffeee397eda50e80

docker gnu(gcc/g++) and llvm(clang/clang++)

https://qiita.com/drafts/059874ea39c4de64c0f7

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)

https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da


C++N4910:2022 tag follower 300人超えました。ありがとうございます。

https://qiita.com/kaizen_nagoya/items/a63fb96d351ac5c16ff7

astyle 使ってみた

https://qiita.com/kaizen_nagoya/items/3c9a87a781d53a1a23f3

DoCAP（ドゥーキャップ）って何ですか？

https://qiita.com/kaizen_nagoya/items/47e0e6509ab792c43327

小川メソッド　覚え（書きかけ）

https://qiita.com/kaizen_nagoya/items/3593d72eca551742df68

 ＜この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。＞

# 文書履歴(document history)
ver. 0.01 初稿 　20220731