22.10.6 Class template reference_wrapper [refwrap] C++N4910:2022 (616) p743.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.6 Class template reference_wrapper [refwrap] C++N4910:2022 (616) p743.cpp

## 算譜(source code)

```c++:p743.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.6 Class template reference_wrapper [refwrap] C++N4910:2022 (616) p743.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.6.1 General [refwrap.general]
  namespace std {
    template<class T> class reference_wrapper {
    public:
// types
      using type = T;
// 22.10.6.2, constructors template<class U>
constexpr reference_wrapper(U&&) noexcept(see below);
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
// 22.10.6.3, assignment
constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
// 22.10.6.4, access
constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
// 22.10.6.5, invocation template<class... ArgTypes>
    constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const;
};
template<class T>
  reference_wrapper(T&) -> reference_wrapper<T>;
}
//  reference_wrapper<T> is a Cpp17CopyConstructible and Cpp17CopyAssignable wrapper around a reference to an object or function of type T.
//  reference_wrapper<T> is a trivially copyable type (6.8.1).
// The template parameter T of reference_wrapper may be an incomplete type.
// 22.10.6.2 Constructors [refwrap.const]
template<class U>
constexpr reference_wrapper(U&& u) noexcept(see below);
Let FUN denote the exposition-only functions void FUN(T&) noexcept;
void FUN(T&&) = delete;
// Constraints: The expression FUN(declval<U>()) is well-formed and is_same_v<remove_cvref_t<U>, reference_wrapper> is false.
// Effects: Creates a variable r as if by T& r = std::forward<U>(u), then constructs a reference_- wrapper object that stores a reference to r.
// Remarks: The exception specification is equivalent to noexcept(FUN(declval<U>())).
// Returns: x + y.
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
// Effects: Constructs a reference_wrapper object that stores a reference to x.get().
// 22.10.6.3 Assignment [refwrap.assign]
constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
// Postconditions: *this stores a reference to x.get(). 
// 22.10.6.4 Access [refwrap.access]
constexpr operator T& () const noexcept;
// Returns: The stored reference. constexpr T& get() const noexcept;
// Returns: The stored reference.
// 22.10.6.5 Invocation [refwrap.invoke]
template<class... ArgTypes>
  constexpr invoke_result_t<T&, ArgTypes...>
    operator()(ArgTypes&&... args) const;
// Mandates: T is a complete type.
// Returns: INVOKE(get(), std::forward<ArgTypes>(args)...). (22.10.4)
// 22.10.6.6 Helper functions [refwrap.helpers]
// The template parameter T of the following ref and cref function templates may be an incomplete type. template<class T> constexpr reference_wrapper<T> ref(T& t) noexcept;
// Returns: reference_wrapper<T>(t).
template<class T> constexpr reference_wrapper<T> ref(reference_wrapper<T> t) noexcept;
// Returns: t.
template<class T> constexpr reference_wrapper<const T> cref(const T& t) noexcept;
// Returns: reference_wrapper <const T>(t).
template<class T> constexpr reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
// Returns: t.
int main(){
  cout  <<  n4910 << endl;
  return EXIT_SUCCESS;
}
```

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

```ubuntu:bash
$ clang++ p743.cpp -std=03 -o p743l -I. -Wall
In file included from p743.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 \
 ^
p743.cpp:19:20: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
      using type = T;
                   ^
p743.cpp:21:1: error: unknown type name 'constexpr'
constexpr reference_wrapper(U&&) noexcept(see below);
^
p743.cpp:21:29: error: unknown type name 'U'
constexpr reference_wrapper(U&&) noexcept(see below);
                            ^
p743.cpp:21:30: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
constexpr reference_wrapper(U&&) noexcept(see below);
                             ^
p743.cpp:21:11: error: constructor cannot have a return type
constexpr reference_wrapper(U&&) noexcept(see below);
          ^~~~~~~~~~~~~~~~~
p743.cpp:21:33: error: expected ';' at end of declaration list
constexpr reference_wrapper(U&&) noexcept(see below);
                                ^
                                ;
p743.cpp:22:1: error: unknown type name 'constexpr'
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
^
p743.cpp:22:11: error: constructor cannot have a return type
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
          ^~~~~~~~~~~~~~~~~
p743.cpp:22:56: error: expected ';' at end of declaration list
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
                                                       ^
                                                       ;
p743.cpp:24:1: error: unknown type name 'constexpr'
constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
^
p743.cpp:24:28: error: expected ';' at end of declaration list
constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
                           ^
                           ;
p743.cpp:26:1: error: unknown type name 'constexpr'
constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
^
p743.cpp:26:31: error: expected ';' at end of declaration list
constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
                              ^
                              ;
p743.cpp:26:42: error: unknown type name 'constexpr'
constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
                                         ^
p743.cpp:26:52: error: declaration of 'T' shadows template parameter
constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
                                                   ^
p743.cpp:16:20: note: template parameter is declared here
    template<class T> class reference_wrapper {
                   ^
p743.cpp:26:53: error: expected ';' at end of declaration list
constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
                                                    ^
                                                    ;
p743.cpp:28:5: error: unknown type name 'constexpr'
    constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const;
    ^
p743.cpp:28:31: error: invalid use of non-static data member 'T'
    constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const;
                              ^
p743.cpp:28:33: error: expected expression
    constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const;
                                ^
p743.cpp:31:3: error: C++ requires a type specifier for all declarations
  reference_wrapper(T&) -> reference_wrapper<T>;
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
$ clang++ p743.cpp -std=2b -o p743l -I. -Wall
p743.cpp:16:29: error: redefinition of 'reference_wrapper'
    template<class T> class reference_wrapper {
                            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/refwrap.h:294:11: note: previous definition is here
    class reference_wrapper
          ^
p743.cpp:31:3: error: redeclaration of deduction guide
  reference_wrapper(T&) -> reference_wrapper<T>;
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/refwrap.h:355:5: note: previous declaration is here
    reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
    ^
p743.cpp:38:45: error: use of undeclared identifier 'see'
constexpr reference_wrapper(U&& u) noexcept(see below);
                                            ^
p743.cpp:38:49: error: expected ')'
constexpr reference_wrapper(U&& u) noexcept(see below);
                                                ^
p743.cpp:38:44: note: to match this '('
constexpr reference_wrapper(U&& u) noexcept(see below);
                                           ^
p743.cpp:38:11: error: deduction guide must be declared in the same scope as template 'std::reference_wrapper'
constexpr reference_wrapper(U&& u) noexcept(see below);
          ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/refwrap.h:294:11: note: template is declared here
    class reference_wrapper
          ^
p743.cpp:38:11: error: deduction guide cannot be declared 'constexpr'
constexpr reference_wrapper(U&& u) noexcept(see below);
~~~~~~~~~ ^
p743.cpp:38:11: error: deduction guide declaration without trailing return type
p743.cpp:40:10: error: unknown type name 'T'
void FUN(T&) noexcept;
         ^
p743.cpp:41:10: error: unknown type name 'T'
void FUN(T&&) = delete;
         ^
p743.cpp:46:35: error: use of class template 'reference_wrapper' requires template arguments; argument deduction not allowed in function prototype
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
                                  ^~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/refwrap.h:294:11: note: template is declared here
    class reference_wrapper
          ^
p743.cpp:46:11: error: deduction guide must be declared in the same scope as template 'std::reference_wrapper'
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
          ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/refwrap.h:294:11: note: template is declared here
    class reference_wrapper
          ^
p743.cpp:46:11: error: deduction guide cannot be declared 'constexpr'
constexpr reference_wrapper(const reference_wrapper& x) noexcept;
~~~~~~~~~ ^
p743.cpp:46:11: error: deduction guide declaration without trailing return type
p743.cpp:49:46: error: use of class template 'reference_wrapper' requires template arguments; argument deduction not allowed in function prototype
constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
                                             ^~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/refwrap.h:294:11: note: template is declared here
    class reference_wrapper
          ^
p743.cpp:49:11: error: use of class template 'reference_wrapper' requires template arguments; argument deduction not allowed in function return type
constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
          ^~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/refwrap.h:294:11: note: template is declared here
    class reference_wrapper
          ^
p743.cpp:52:20: error: unknown type name 'T'
constexpr operator T& () const noexcept;
                   ^
p743.cpp:57:29: error: use of undeclared identifier 'T'
  constexpr invoke_result_t<T&, ArgTypes...>
                            ^
p743.cpp:57:31: error: expected expression
  constexpr invoke_result_t<T&, ArgTypes...>
                              ^
p743.cpp:58:36: error: non-member function cannot have 'const' qualifier
    operator()(ArgTypes&&... args) const;
                                   ^~~~~
19 errors generated.

$ g++ p743.cpp -std=03 -o p743g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p743.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 \
      |  ^~~~~
p743.cpp:21:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   21 | constexpr reference_wrapper(U&&) noexcept(see below);
      | ^~~~~~~~~
p743.cpp:21:34: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   21 | constexpr reference_wrapper(U&&) noexcept(see below);
      |                                  ^~~~~~~~
p743.cpp:19:13: error: expected nested-name-specifier before 'type'
   19 |       using type = T;
      |             ^~~~
p743.cpp:21:1: error: 'constexpr' does not name a type
   21 | constexpr reference_wrapper(U&&) noexcept(see below);
      | ^~~~~~~~~
p743.cpp:21:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:22:1: error: 'constexpr' does not name a type
   22 | constexpr reference_wrapper(const reference_wrapper& x) noexcept;
      | ^~~~~~~~~
p743.cpp:22:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:24:1: error: 'constexpr' does not name a type
   24 | constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
      | ^~~~~~~~~
p743.cpp:24:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:26:1: error: 'constexpr' does not name a type
   26 | constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
      | ^~~~~~~~~
p743.cpp:26:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:26:42: error: 'constexpr' does not name a type
   26 | constexpr operator T& () const noexcept; constexpr T& get() const noexcept;
      |                                          ^~~~~~~~~
p743.cpp:26:42: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:28:5: error: 'constexpr' does not name a type
   28 |     constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const;
      |     ^~~~~~~~~
p743.cpp:28:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:31:48: error: expected constructor, destructor, or type conversion before ';' token
   31 |   reference_wrapper(T&) -> reference_wrapper<T>;
      |                                                ^
p743.cpp:38:1: error: 'constexpr' does not name a type
   38 | constexpr reference_wrapper(U&& u) noexcept(see below);
      | ^~~~~~~~~
p743.cpp:38:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:40:6: error: variable or field 'FUN' declared void
   40 | void FUN(T&) noexcept;
      |      ^~~
p743.cpp:40:10: error: 'T' was not declared in this scope
   40 | void FUN(T&) noexcept;
      |          ^
p743.cpp:40:12: error: expected primary-expression before ')' token
   40 | void FUN(T&) noexcept;
      |            ^
p743.cpp:41:6: error: variable or field 'FUN' declared void
   41 | void FUN(T&&) = delete;
      |      ^~~
p743.cpp:41:10: error: 'T' was not declared in this scope
   41 | void FUN(T&&) = delete;
      |          ^
p743.cpp:41:13: error: expected primary-expression before ')' token
   41 | void FUN(T&&) = delete;
      |             ^
p743.cpp:46:1: error: 'constexpr' does not name a type
   46 | constexpr reference_wrapper(const reference_wrapper& x) noexcept;
      | ^~~~~~~~~
p743.cpp:46:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:49:1: error: 'constexpr' does not name a type
   49 | constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
      | ^~~~~~~~~
p743.cpp:49:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:52:1: error: 'constexpr' does not name a type
   52 | constexpr operator T& () const noexcept;
      | ^~~~~~~~~
p743.cpp:52:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:56:15: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   56 | template<class... ArgTypes>
      |               ^~~
p743.cpp:57:3: error: 'constexpr' does not name a type
   57 |   constexpr invoke_result_t<T&, ArgTypes...>
      |   ^~~~~~~~~
p743.cpp:57:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:64:19: error: 'constexpr' does not name a type
   64 | template<class T> constexpr reference_wrapper<T> ref(reference_wrapper<T> t) noexcept;
      |                   ^~~~~~~~~
p743.cpp:64:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:66:19: error: 'constexpr' does not name a type
   66 | template<class T> constexpr reference_wrapper<const T> cref(const T& t) noexcept;
      |                   ^~~~~~~~~
p743.cpp:66:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p743.cpp:68:19: error: 'constexpr' does not name a type
   68 | template<class T> constexpr reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
      |                   ^~~~~~~~~
p743.cpp:68:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'

$ g++ p743.cpp -std=2b -o p743g -I. -Wall
p743.cpp:16:29: error: redefinition of 'class std::reference_wrapper<_Tp>'
   16 |     template<class T> class reference_wrapper {
      |                             ^~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/string:51,
                 from /usr/local/include/c++/12.1.0/bits/locale_classes.h:40,
                 from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
                 from /usr/local/include/c++/12.1.0/ios:42,
                 from /usr/local/include/c++/12.1.0/ostream:38,
                 from /usr/local/include/c++/12.1.0/iostream:39,
                 from N4910.h:2,
                 from p743.cpp:10:
/usr/local/include/c++/12.1.0/bits/refwrap.h:303:11: note: previous definition of 'class std::reference_wrapper<_Tp>'
  303 |     class reference_wrapper
      |           ^~~~~~~~~~~~~~~~~
p743.cpp:31:3: error: deduction guide 'template<class T> std::reference_wrapper(T&)-> reference_wrapper<_Tp' redeclared
   31 |   reference_wrapper(T&) -> reference_wrapper<T>;
      |   ^~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/refwrap.h:364:5: note: 'template<class _Tp> std::reference_wrapper(_Tp&)-> reference_wrapper<_Tp>' previously declared here
  364 |     reference_wrapper(_Tp&) -> reference_wrapper<_Tp>;
      |     ^~~~~~~~~~~~~~~~~
p743.cpp:38:45: error: 'see' was not declared in this scope
   38 | constexpr reference_wrapper(U&& u) noexcept(see below);
      |                                             ^~~
p743.cpp:38:48: error: expected ')' before 'below'
   38 | constexpr reference_wrapper(U&& u) noexcept(see below);
      |                                            ~   ^~~~~~
      |                                                )
p743.cpp:38:49: error: expected initializer before 'below'
   38 | constexpr reference_wrapper(U&& u) noexcept(see below);
      |                                                 ^~~~~
p743.cpp:40:6: error: variable or field 'FUN' declared void
   40 | void FUN(T&) noexcept;
      |      ^~~
p743.cpp:40:10: error: 'T' was not declared in this scope
   40 | void FUN(T&) noexcept;
      |          ^
p743.cpp:40:12: error: expected primary-expression before ')' token
   40 | void FUN(T&) noexcept;
      |            ^
p743.cpp:41:6: error: variable or field 'FUN' declared void
   41 | void FUN(T&&) = delete;
      |      ^~~
p743.cpp:41:10: error: 'T' was not declared in this scope
   41 | void FUN(T&&) = delete;
      |          ^
p743.cpp:41:13: error: expected primary-expression before ')' token
   41 | void FUN(T&&) = delete;
      |             ^
p743.cpp:46:29: error: template placeholder type 'const reference_wrapper<...auto...>' must be followed by a simple declarator-id
   46 | constexpr reference_wrapper(const reference_wrapper& x) noexcept;
      |                             ^~~~~
In file included from /usr/local/include/c++/12.1.0/bits/move.h:57,
                 from /usr/local/include/c++/12.1.0/bits/exception_ptr.h:43,
                 from /usr/local/include/c++/12.1.0/exception:168,
                 from /usr/local/include/c++/12.1.0/ios:39:
/usr/local/include/c++/12.1.0/type_traits:45:11: note: 'template<class _Tp> class std::reference_wrapper' declared here
   45 |     class reference_wrapper;
      |           ^~~~~~~~~~~~~~~~~
p743.cpp:46:1: error: 'decl-specifier' in declaration of deduction guide
   46 | constexpr reference_wrapper(const reference_wrapper& x) noexcept;
      | ^~~~~~~~~
p743.cpp:46:11: error: deduction guide for 'std::reference_wrapper<_Tp>' must have trailing return type
   46 | constexpr reference_wrapper(const reference_wrapper& x) noexcept;
      |           ^~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/type_traits:45:11: note: 'template<class _Tp> class std::reference_wrapper' declared here
   45 |     class reference_wrapper;
      |           ^~~~~~~~~~~~~~~~~
p743.cpp:49:40: error: template placeholder type 'const reference_wrapper<...auto...>' must be followed by a simple declarator-id
   49 | constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
      |                                        ^~~~~
/usr/local/include/c++/12.1.0/type_traits:45:11: note: 'template<class _Tp> class std::reference_wrapper' declared here
   45 |     class reference_wrapper;
      |           ^~~~~~~~~~~~~~~~~
p743.cpp:49:11: error: deduced class type 'reference_wrapper' in function return type
   49 | constexpr reference_wrapper& operator=(const reference_wrapper& x) noexcept;
      |           ^~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/type_traits:45:11: note: 'template<class _Tp> class std::reference_wrapper' declared here
   45 |     class reference_wrapper;
      |           ^~~~~~~~~~~~~~~~~
p743.cpp:52:20: error: 'T' does not name a type
   52 | constexpr operator T& () const noexcept;
      |                    ^
p743.cpp:57:29: error: 'T' was not declared in this scope
   57 |   constexpr invoke_result_t<T&, ArgTypes...>
      |                             ^
p743.cpp:57:44: error: template argument 1 is invalid
   57 |   constexpr invoke_result_t<T&, ArgTypes...>
      |                                            ^
p743.cpp:58:36: error: non-member function 'constexpr int operator()(ArgTypes&& ...)' cannot have cv-qualifier
   58 |     operator()(ArgTypes&&... args) const;
      |                                    ^~~~~
p743.cpp:58:5: error: 'constexpr int operator()(ArgTypes&& ...)' must be a non-static member function
   58 |     operator()(ArgTypes&&... args) const;
      |     ^~~~~~~~

```

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

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

# 参考資料(reference)

@kazuo_reve 私が効果を確認した「小川メソッド」

https://qiita.com/kazuo_reve/items/a3ea1d9171deeccc04da

## 自己参照(self 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