22.9.2.1 General [template.bitset.general] C++N4910:2022 (608) p733.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
https://cpprefjp.github.io
http://ja.cppreference.com/

また
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.9.2.1 General [template.bitset.general] C++N4910:2022 (608) p733.cpp

## 算譜(source code)

```c++:p733.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.9.2.1 General [template.bitset.general] C++N4910:2022 (608) p733.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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <coroutine>
#include <vector>
#include <complex>
#include <map>
#include <atomic>
#include <unordered_map>
#include <optional>
#include <memory>
#include <variant>
#include <any>
#include <typeinfo>

using namespace std;

// Example 1
namespace std {
template<size_t N> class bitset {
public:
// bit reference
    class reference {
        friend class bitset;
        reference() noexcept;
    public:
        reference(const reference&) = default;
        ~reference();
        reference& operator=(bool x) noexcept;
        reference& operator=(const reference&) bool operator~() const noexcept;
        operator bool() const noexcept;
        reference& flip() noexcept;
    };
// noexcept; // // // //
    for b[i] = x;
    for b[i] = b[j];
    flips the bit
    for x = b[i];
    for b[i].flip();
// 22.9.2.2, constructors
    constexpr bitset() noexcept;
    constexpr bitset(unsigned long long val) noexcept;
    template<class charT, class traits, class Allocator>
    explicit bitset(
        const basic_string<charT, traits, Allocator>& str,
        typename basic_string<charT, traits, Allocator>::size_type pos = 0,
        typename basic_string<charT, traits, Allocator>::size_type n
        = basic_string<charT, traits, Allocator>::npos,
        charT zero = charT('0'),
        charT one = charT('1'));
    template<class charT>
    explicit bitset(
        const charT* str,
        typename basic_string<charT>::size_type n = basic_string<charT>::npos,
        charT zero = charT('0'),
        charT one = charT('1'));
// 22.9.2.3, bitset operations
    bitset& operator&=(const bitset& rhs) noexcept;
    bitset& operator|=(const bitset& rhs) noexcept;
    bitset& operator^=(const bitset& rhs) noexcept;
    bitset& operator<<=(size_t pos) noexcept;
    bitset& operator>>=(size_t pos) noexcept;
    bitset& set() noexcept;
    bitset& set(size_t pos, bool val = true);
    bitset& reset() noexcept;
    bitset& reset(size_t pos);
    bitset operator~() const noexcept;
    bitset& flip() noexcept;
    bitset& flip(size_t pos);
// element access
    constexpr bool operator[](size_t pos) const;
    reference operator[](size_t pos);
    unsigned long to_ulong() const;
    unsigned long long to_ullong() const;
    template<class charT = char,
             class traits = char_traits<charT>,
             class Allocator = allocator<charT>>
    basic_string<charT, traits, Allocator>
// for b[i]; // for b[i];
    to_string(charT zero = charT('0'), charT one = charT('1')) const;
    size_t count() const noexcept;
    constexpr size_t size() const noexcept;
    bool operator==(const bitset& rhs) const noexcept;
    bool test(size_t pos) const;
    bool all() const noexcept;
    bool any() const noexcept;
    bool none() const noexcept;
    bitset operator<<(size_t pos) const noexcept;
    bitset operator>>(size_t pos) const noexcept;
};
// 22.9.3, hash support
template<class T> struct hash;
template<size_t N> struct hash<bitset<N>>;
}
//  The class template bitset<N> describes an object that can store a sequence consisting of a fixed number of bits, N.
//  Each bit represents either the value zero (reset) or one (set). To toggle a bit is to change the value zero to one, or the value one to zero. Each bit has a non-negative position pos. When converting between an object of class bitset<N> and a value of some integral type, bit position pos corresponds to the bit value 1 << pos. The integral value corresponding to two or more bits is the sum of their bit values.
//  The functions described in 22.9.2 can report three kinds of errors, each associated with a distinct exception:
// — an invalid-argument error is associated with exceptions of type invalid_argument (19.2.5);
// — an out-of-range error is associated with exceptions of type out_of_range (19.2.7);
// — an overflow error is associated with exceptions of type overflow_error (19.2.10).
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}
```

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

```ubuntu:bash
$ clang++ p733.cpp -std=03 -o p733l -I. -Wall
In file included from p733.cpp:19:
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 \
 ^
p733.cpp:36:20: error: expected ';' at end of declaration list
        reference() noexcept;
                   ^
                   ;
p733.cpp:38:31: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
reference(const reference&) = default; ~reference();
                              ^
p733.cpp:39:29: error: expected ';' at end of declaration list
reference& operator=(bool x) noexcept; 
                            ^
                            ;
p733.cpp:40:39: error: expected ';' at end of declaration list
reference& operator=(const reference&) bool operator~() const noexcept; 
                                      ^
                                      ;
p733.cpp:41:22: error: expected ';' at end of declaration list
operator bool() const noexcept; 
                     ^
                     ;
p733.cpp:42:18: error: expected ';' at end of declaration list
reference& flip() noexcept;
                 ^
                 ;
p733.cpp:45:1: error: expected member name or ';' after declaration specifiers
for b[i] = x;
^
p733.cpp:46:1: error: expected member name or ';' after declaration specifiers
for b[i] = b[j];
^
p733.cpp:47:1: error: unknown type name 'flips'
flips the bit
^
p733.cpp:47:10: error: expected ';' at end of declaration list
flips the bit
         ^
         ;
p733.cpp:49:1: error: expected member name or ';' after declaration specifiers
for b[i].flip();
^
p733.cpp:51:1: error: unknown type name 'constexpr'
constexpr bitset() noexcept;
^
p733.cpp:51:11: error: constructor cannot have a return type
constexpr bitset() noexcept;
          ^~~~~~
p733.cpp:51:19: error: expected ';' at end of declaration list
constexpr bitset() noexcept;
                  ^
                  ;
p733.cpp:52:1: error: unknown type name 'constexpr'
constexpr bitset(unsigned long long val) noexcept; 
^
p733.cpp:52:11: error: constructor cannot have a return type
constexpr bitset(unsigned long long val) noexcept; 
          ^~~~~~
p733.cpp:52:41: error: expected ';' at end of declaration list
constexpr bitset(unsigned long long val) noexcept; 
                                        ^
                                        ;
p733.cpp:68:38: error: expected ';' at end of declaration list
bitset& operator&=(const bitset& rhs) noexcept; 
                                     ^
                                     ;
p733.cpp:69:38: error: expected ';' at end of declaration list
bitset& operator|=(const bitset& rhs) noexcept; bitset& operator^=(const bitset& rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
                                     ^
                                     ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
$ clang++ p733.cpp -std=2b -o p733l -I. -Wall
p733.cpp:40:39: error: expected ';' at end of declaration list
reference& operator=(const reference&) bool operator~() const noexcept; 
                                      ^
                                      ;
p733.cpp:45:1: error: expected member name or ';' after declaration specifiers
for b[i] = x;
^
p733.cpp:46:1: error: expected member name or ';' after declaration specifiers
for b[i] = b[j];
^
p733.cpp:47:1: error: unknown type name 'flips'
flips the bit
^
p733.cpp:47:10: error: expected ';' at end of declaration list
flips the bit
         ^
         ;
p733.cpp:49:1: error: expected member name or ';' after declaration specifiers
for b[i].flip();
^
6 errors generated.

$ g++ p733.cpp -std=03 -o p733g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from p733.cpp:19:
/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 \
      |  ^~~~~
p733.cpp:36:21: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   36 |         reference() noexcept;
      |                     ^~~~~~~~
p733.cpp:51:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   51 | constexpr bitset() noexcept;
      | ^~~~~~~~~
p733.cpp:36:19: error: expected ';' at end of member declaration
   36 |         reference() noexcept;
      |                   ^
      |                    ;
p733.cpp:36:21: error: 'noexcept' does not name a type
   36 |         reference() noexcept;
      |                     ^~~~~~~~
p733.cpp:36:21: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:38:31: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   38 | reference(const reference&) = default; ~reference();
      |                               ^~~~~~~
p733.cpp:39:28: error: expected ';' at end of member declaration
   39 | reference& operator=(bool x) noexcept;
      |                            ^
      |                             ;
p733.cpp:39:30: error: 'noexcept' does not name a type
   39 | reference& operator=(bool x) noexcept;
      |                              ^~~~~~~~
p733.cpp:39:30: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:40:38: error: expected ';' at end of member declaration
   40 | reference& operator=(const reference&) bool operator~() const noexcept;
      |                                      ^
      |                                       ;
p733.cpp:40:57: error: expected ';' at end of member declaration
   40 | reference& operator=(const reference&) bool operator~() const noexcept;
      |                                                         ^~~~~
      |                                                              ;
p733.cpp:40:63: error: 'noexcept' does not name a type
   40 | reference& operator=(const reference&) bool operator~() const noexcept;
      |                                                               ^~~~~~~~
p733.cpp:40:63: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:41:17: error: expected ';' at end of member declaration
   41 | operator bool() const noexcept;
      |                 ^~~~~
      |                      ;
p733.cpp:41:23: error: 'noexcept' does not name a type
   41 | operator bool() const noexcept;
      |                       ^~~~~~~~
p733.cpp:41:23: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:42:17: error: expected ';' at end of member declaration
   42 | reference& flip() noexcept;
      |                 ^
      |                  ;
p733.cpp:42:19: error: 'noexcept' does not name a type
   42 | reference& flip() noexcept;
      |                   ^~~~~~~~
p733.cpp:42:19: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:45:1: error: expected unqualified-id before 'for'
   45 | for b[i] = x;
      | ^~~
p733.cpp:46:1: error: expected unqualified-id before 'for'
   46 | for b[i] = b[j];
      | ^~~
p733.cpp:47:1: error: 'flips' does not name a type
   47 | flips the bit
      | ^~~~~
p733.cpp:49:1: error: expected unqualified-id before 'for'
   49 | for b[i].flip();
      | ^~~
p733.cpp:51:1: error: 'constexpr' does not name a type
   51 | constexpr bitset() noexcept;
      | ^~~~~~~~~
p733.cpp:51:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:52:1: error: 'constexpr' does not name a type
   52 | constexpr bitset(unsigned long long val) noexcept;
      | ^~~~~~~~~
p733.cpp:52:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:68:37: error: expected ';' at end of member declaration
   68 | bitset& operator&=(const bitset& rhs) noexcept;
      |                                     ^
      |                                      ;
p733.cpp:68:39: error: 'noexcept' does not name a type
   68 | bitset& operator&=(const bitset& rhs) noexcept;
      |                                       ^~~~~~~~
p733.cpp:68:39: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:69:37: error: expected ';' at end of member declaration
   69 | bitset& operator|=(const bitset& rhs) noexcept; bitset& operator^=(const bitset& rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                     ^
      |                                      ;
p733.cpp:69:39: error: 'noexcept' does not name a type
   69 | bitset& operator|=(const bitset& rhs) noexcept; bitset& operator^=(const bitset& rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                       ^~~~~~~~
p733.cpp:69:39: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:69:85: error: expected ';' at end of member declaration
   69 | bitset& operator|=(const bitset& rhs) noexcept; bitset& operator^=(const bitset& rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                     ^
      |                                                                                      ;
p733.cpp:69:87: error: 'noexcept' does not name a type
   69 | bitset& operator|=(const bitset& rhs) noexcept; bitset& operator^=(const bitset& rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                       ^~~~~~~~
p733.cpp:69:87: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:69:127: error: expected ';' at end of member declaration
   69 | oexcept; bitset& operator^=(const bitset& rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                        ^
      |                                                                                         ;
p733.cpp:69:129: error: 'noexcept' does not name a type
   69 | xcept; bitset& operator^=(const bitset& rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                        ^~~~~~~~

p733.cpp:69:129: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:69:169: error: expected ';' at end of member declaration
   69 | rhs) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                        ^
      |                                                                                         ;
p733.cpp:69:171: error: 'noexcept' does not name a type
   69 | s) noexcept; bitset& operator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                        ^~~~~~~~

p733.cpp:69:171: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:69:193: error: expected ';' at end of member declaration
   69 | perator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                        ^
      |                                                                                         ;
p733.cpp:69:195: error: 'noexcept' does not name a type
   69 | perator<<=(size_t pos) noexcept; bitset& operator>>=(size_t pos) noexcept; bitset& set() noexcept;
      |                                                                                          ^~~~~~~~

p733.cpp:69:195: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:70:57: error: expected ';' at end of member declaration
   70 | bitset& set(size_t pos, bool val = true); bitset& reset() noexcept;
      |                                                         ^
      |                                                          ;
p733.cpp:70:59: error: 'noexcept' does not name a type
   70 | bitset& set(size_t pos, bool val = true); bitset& reset() noexcept;
      |                                                           ^~~~~~~~
p733.cpp:70:59: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:72:20: error: expected ';' at end of member declaration
   72 | bitset operator~() const noexcept;
      |                    ^~~~~
      |                         ;
p733.cpp:72:26: error: 'noexcept' does not name a type
   72 | bitset operator~() const noexcept;
      |                          ^~~~~~~~
p733.cpp:72:26: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:73:14: error: expected ';' at end of member declaration
   73 | bitset& flip() noexcept;
      |              ^
      |               ;
p733.cpp:73:16: error: 'noexcept' does not name a type
   73 | bitset& flip() noexcept;
      |                ^~~~~~~~
p733.cpp:73:16: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:76:1: error: 'constexpr' does not name a type
   76 | constexpr bool operator[](size_t pos) const;
      | ^~~~~~~~~
p733.cpp:76:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:82:43: error: spurious '>>', use '>' to terminate a template argument list
   82 |          class Allocator = allocator<charT>>
      |                                           ^~
p733.cpp:83:31: error: 'Allocator' was not declared in this scope; did you mean 'allocator'?
   83 |   basic_string<charT, traits, Allocator>
      |                               ^~~~~~~~~
      |                               allocator
p733.cpp:83:40: error: template argument 3 is invalid
   83 |   basic_string<charT, traits, Allocator>
      |                                        ^
p733.cpp:82:28: error: two or more data types in declaration of 'type name'
   82 |          class Allocator = allocator<charT>>
      |                            ^~~~~~~~~~~~~~~~~
p733.cpp:85:7: error: expected '>' before 'to_string'
   85 |       to_string(charT zero = charT('0'), charT one = charT('1')) const;
      |       ^~~~~~~~~
p733.cpp:85:71: error: expected unqualified-id before ';' token
   85 |       to_string(charT zero = charT('0'), charT one = charT('1')) const;
      |                                                                       ^
p733.cpp:86:18: error: expected ';' at end of member declaration
   86 |   size_t count() const noexcept;
      |                  ^~~~~
      |                       ;
p733.cpp:86:24: error: 'noexcept' does not name a type
   86 |   size_t count() const noexcept;
      |                        ^~~~~~~~
p733.cpp:86:24: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:87:3: error: 'constexpr' does not name a type
   87 |   constexpr size_t size() const noexcept;
      |   ^~~~~~~~~
p733.cpp:87:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:88:38: error: expected ';' at end of member declaration
   88 |   bool operator==(const bitset& rhs) const noexcept;
      |                                      ^~~~~
      |                                           ;
p733.cpp:88:44: error: 'noexcept' does not name a type
   88 |   bool operator==(const bitset& rhs) const noexcept;
      |                                            ^~~~~~~~
p733.cpp:88:44: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:90:14: error: expected ';' at end of member declaration
   90 |   bool all() const noexcept;
      |              ^~~~~
      |                   ;
p733.cpp:90:20: error: 'noexcept' does not name a type
   90 |   bool all() const noexcept;
      |                    ^~~~~~~~
p733.cpp:90:20: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:91:14: error: expected ';' at end of member declaration
   91 |   bool any() const noexcept;
      |              ^~~~~
      |                   ;
p733.cpp:91:20: error: 'noexcept' does not name a type
   91 |   bool any() const noexcept;
      |                    ^~~~~~~~
p733.cpp:91:20: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:92:15: error: expected ';' at end of member declaration
   92 |   bool none() const noexcept;
      |               ^~~~~
      |                    ;
p733.cpp:92:21: error: 'noexcept' does not name a type
   92 |   bool none() const noexcept;
      |                     ^~~~~~~~
p733.cpp:92:21: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:93:33: error: expected ';' at end of member declaration
   93 |   bitset operator<<(size_t pos) const noexcept;
      |                                 ^~~~~
      |                                      ;
p733.cpp:93:39: error: 'noexcept' does not name a type
   93 |   bitset operator<<(size_t pos) const noexcept;
      |                                       ^~~~~~~~
p733.cpp:93:39: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:94:33: error: expected ';' at end of member declaration
   94 |   bitset operator>>(size_t pos) const noexcept;
      |                                 ^~~~~
      |                                      ;
p733.cpp:94:39: error: 'noexcept' does not name a type
   94 |   bitset operator>>(size_t pos) const noexcept;
      |                                       ^~~~~~~~
p733.cpp:94:39: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p733.cpp:97:71: warning: '>>' operator is treated as two right angle brackets in C++11 [-Wc++11-compat]
   97 | template<class T> struct hash; template<size_t N> struct hash<bitset<N>>;
      |                                                                       ^~
p733.cpp:97:71: note: suggest parentheses around '>>' expression
p733.cpp:97:71: error: template argument 1 is invalid
p733.cpp:97:63: error: template argument 1 is invalid
   97 | template<class T> struct hash; template<size_t N> struct hash<bitset<N>>;
      |                                                               ^~~~~~~~~~

$ g++ p733.cpp -std=2b -o p733g -I. -Wall
p733.cpp:40:38: error: expected ';' at end of member declaration
   40 | reference& operator=(const reference&) bool operator~() const noexcept;
      |                                      ^
      |                                       ;
p733.cpp:45:1: error: expected unqualified-id before 'for'
   45 | for b[i] = x;
      | ^~~
p733.cpp:46:1: error: expected unqualified-id before 'for'
   46 | for b[i] = b[j];
      | ^~~
p733.cpp:47:1: error: 'flips' does not name a type
   47 | flips the bit
      | ^~~~~
p733.cpp:49:1: error: expected unqualified-id before 'for'
   49 | for b[i].flip();
      | ^~~

```

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

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

# 参考資料(reference)

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

https://cpprefjp.github.io/

コンパイラの実装状況

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


typedef は C++11 ではオワコン

https://qiita.com/Linda_pp/items/44a67c64c14cba00eef1

C99からC++14を駆け抜けるC++講座

https://qiita.com/yumetodo/items/e49a673afd9a3ecb81a8


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

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

## 自己参照(self reference)

ockerに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 200人超えました。ありがとうございます。

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

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

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

コピペコンパイルエラーあるある

https://qiita.com/kaizen_nagoya/items/29c832de9d762aed2761

C++ Error Message Collection(1)does not name a type, 11 articles

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

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

Compare the contents of C++N4910:2022, C++N4741:2018 and C++N4606:2015

https://qiita.com/kaizen_nagoya/items/483246d40f98abff7ded

C++ sample list

https://qiita.com/kaizen_nagoya/items/54ad75b73825b7c04f86

clang++, g++コンパイルエラー方針の違いの例

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

astyle 使ってみた

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

C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da

Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f

C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff

Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d

cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67

MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed

ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1

C言語（C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9

'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11

Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc

MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb

どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00

MISRA C まとめ #include <misra_c.h>
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671

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

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

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

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


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

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