25 Iterators library [iterators] 25.2 Header <iterator> synopsis [iterator.synopsis] C++N4910:2022 (644) p967.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.

# 25 25 Iterators library [iterators] 25.2 Header <iterator> synopsis [iterator.synopsis] C++N4910:2022 (644) p967.cpp

## 算譜(source code)

```c++:p967.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 = "25 Iterators library [iterators] 25.2 Header <iterator> synopsis [iterator.synopsis] C++N4910:2022 (644) p967.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;

// 25.2 Header <iterator> synopsis  [iterator.synopsis]
#include <compare>
#include <concepts>
namespace std {
template<class T>
template<class T>
// see 17.11.1 // see 18.3
using with-reference = T&; // exposition only
concept can-reference // exposition only = requires { typename with-reference<T>; };
template<class T> concept dereferenceable // exposition only = requires(T& t) {
{ *t } -> can-reference ; // not required to be equality-preserving };
// 25.3.2, associated types
// 25.3.2.1, incrementable traits
template<class> struct incrementable_traits;
template<class T>
using iter_difference_t = see_below;
// 25.3.2.2, indirectly readable traits
template<class> struct indirectly_readable_traits;
template<class T>
using iter_value_t = see_below;
// 25.3.2.3, iterator traits
template<class I> struct iterator_traits;
template<class T> requires is_object_v<T> struct iterator_traits<T*>;
template<dereferenceable T>
using iter_reference_t = decltype(*declval<T&>());
namespace ranges {
// 25.3.3, customization point objects inline namespace unspecified {
// 25.3.3.1, ranges::iter_move inline constexpr unspecified
iter_move =
    unspecified ;
// 25.3.3.2, ranges::iter_swap inline constexpr unspecified
template<dereferenceable T> requires requires(T& t) {
    iter_swap
        = unspecified ;
}
}
{
    ranges::iter_move(t)
} -> cans_reference;
}
using iter_rvalue_reference_t
    = decltype(ranges::iter_move(declval<T&>()));
// 25.3.4, iterator concepts
// 25.3.4.2, concept indirectly_readable template<class In>
concept indirectly_readable = see_below;
template<indirectly_readable T>
using iter_common_reference_t =
    common_reference_t<iter_reference_t<T>, iter_value_t<T>&>;
// 25.3.4.3, concept indirectly_writable template<class Out, class T>
concept indirectly_writable = see_below;
// 25.3.4.4, concept weakly_incrementable template<class I>
concept weakly_incrementable = see_below;
// 25.3.4.5, concept incrementable template<class I>
concept incrementable = see_below;
// 25.3.4.6, concept input_or_output_iterator template<class I>
concept input_or_output_iterator = see_below;
// 25.3.4.7, concept sentinel_for template<class S, class I>
concept sentinel_for = see_below;
// 25.3.4.8, concept sized_sentinel_for template<class S, class I>
inline constexpr bool disable_sized_sentinel_for = false;
template<class S, class I>
concept sized_sentinel_for = see_below;
// 25.3.4.9, concept input_iterator template<class I>
concept input_iterator = see_below;
// 25.3.4.10, concept output_iterator template<class I, class T>
concept output_iterator = see_below;
// 25.3.4.11, concept forward_iterator template<class I>
concept forward_iterator = see_below;
// 25.3.4.12, concept bidirectional_iterator template<class I>
concept bidirectional_iterator = see_below;
// 25.3.4.13, concept random_access_iterator template<class I>
concept random_access_iterator = see_below;
// 25.3.4.14, concept contiguous_iterator template<class I>
concept contiguous_iterator = see_below;
// 25.3.6, indirect callable requirements // 25.3.6.2, indirect callables template<class F, class I>
concept indirectly_unary_invocable = see_below;
template<class F, class I>
concept indirectly_regular_unary_invocable = see_below;
template<class F, class I>
concept indirect_unary_predicate = see_below;
template<class F, class I1, class I2>
concept indirect_binary_predicate = see_below;
template<class F, class I1, class I2 = I1>
concept indirect_equivalence_relation = see_below;
template<class F, class I1, class I2 = I1>
concept indirect_strict_weak_order = see_below;
template<class F, class... Is>
requires (indirectly_readable<Is> && ...) && invocable<F, iter_reference_t<Is>...>
using indirect_result_t = invoke_result_t<F, iter_reference_t<Is>...>;
// 25.3.6.3, projected
template<indirectly_readable I, indirectly_regular_unary_invocable<I> Proj>
struct projected;
template<weakly_incrementable I, class Proj>
struct incrementable_traits<projected<I, Proj>>;
// 25.3.7, common algorithm requirements // 25.3.7.2, concept indirectly_movable template<class In, class Out>
concept indirectly_movable = see_below;
template<class In, class Out>
concept indirectly_movable_storable = see_below;
// 25.3.7.3, concept indirectly_copyable template<class In, class Out>
concept indirectly_copyable = see_below;
template<class In, class Out>
concept indirectly_copyable_storable = see_below;
// 25.3.7.4, concept indirectly_swappable template<class I1, class I2 = I1>
concept indirectly_swappable = see_below;
// 25.3.7.5, concept indirectly_comparable
template<class I1, class I2, class R, class P1 = identity, class P2 = identity>
concept indirectly_comparable = see_below;
// 25.3.7.6, concept permutable template<class I>
concept permutable = see_below;
// 25.3.7.7, concept mergeable template<class I1, class I2, class Out,
class R = ranges::less, class P1 = identity, class P2 = identity> concept mergeable = see_below;
// 25.3.7.8, concept sortable
template<class I, class R = ranges::less, class P = identity>
concept sortable = see_below;
// 25.4, primitives
// 25.4.2, iterator tags
struct input_iterator_tag { };
struct output_iterator_tag { };
struct forward_iterator_tag: public input_iterator_tag { };
struct bidirectional_iterator_tag: public forward_iterator_tag { };
struct random_access_iterator_tag: public bidirectional_iterator_tag { };
struct contiguous_iterator_tag: public random_access_iterator_tag { };
// 25.4.3, iterator operations
template<class InputIterator, class Distance>
constexpr void
advance(InputIterator& i, Distance n);
template<class InputIterator>
constexpr typename iterator_traits<InputIterator>::difference_type
distance(InputIterator first, InputIterator last);
template<class InputIterator>
constexpr InputIterator
next(InputIterator x,
     typename iterator_traits<InputIterator>::difference_type n = 1);
template<class BidirectionalIterator>
constexpr BidirectionalIterator
prev(BidirectionalIterator x,
     typename iterator_traits<BidirectionalIterator>::difference_type n = 1);
// 25.4.4, range iterator operations namespace ranges {
// 25.4.4.2, ranges::advance template<input_or_output_iterator I>
constexpr void advance(I& i, iter_difference_t<I> n);
template<input_or_output_iterator I, sentinel_for<I> S>
constexpr void advance(I& i, S bound);
template<input_or_output_iterator I, sentinel_for<I> S>
constexpr iter_difference_t<I> advance(I& i, iter_difference_t<I> n, S bound);
// 25.4.4.3, ranges::distance template<input_or_output_iterator I, sentinel_for<I> S>
requires (!sized_sentinel_for<S, I>)
constexpr iter_difference_t<I> distance(I first, S last);
template<input_or_output_iterator I, sized_sentinel_for<I> S>
constexpr iter_difference_t<I> distance(const I& first, const S& last);
template<range R>
constexpr range_difference_t<R> distance(R&& r);
// 25.4.4.4, ranges::next template<input_or_output_iterator I>
constexpr I next(I x);
template<input_or_output_iterator I>
constexpr I next(I x, iter_difference_t<I> n);
template<input_or_output_iterator I, sentinel_for<I> S>
constexpr I next(I x, S bound);
template<input_or_output_iterator I, sentinel_for<I> S>
constexpr I next(I x, iter_difference_t<I> n, S bound);
// 25.4.4.5, ranges::prev template<bidirectional_iterator I>
constexpr I prev(I x);
template<bidirectional_iterator I>
constexpr I prev(I x, iter_difference_t<I> n);
template<bidirectional_iterator I>
constexpr I prev(I x, iter_difference_t<I> n, I bound);
}
// 25.5, predefined iterators and sentinels
// 25.5.1, reverse iterators
template<class Iterator> class reverse_iterator;
template<class Iterator1, class Iterator2>
constexpr bool operator==(
    const reverse_iterator<Iterator1>& x,
    const reverse_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator!=(
    const reverse_iterator<Iterator1>& x,
    const reverse_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator<(
    const reverse_iterator<Iterator1>& x,
    const reverse_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator>(
    const reverse_iterator<Iterator1>& x,
    const reverse_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator<=(
    const reverse_iterator<Iterator1>& x,
    const reverse_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator>=(
    const reverse_iterator<Iterator1>& x,
    const reverse_iterator<Iterator2>& y);
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const reverse_iterator<Iterator1>& x,
            const reverse_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr auto operator-(
    const reverse_iterator<Iterator1>& x,
    const reverse_iterator<Iterator2>& y) -> decltype(y.base() - x.base());
template<class Iterator>
constexpr reverse_iterator<Iterator> operator+(
    iter_difference_t<Iterator> n,
    const reverse_iterator<Iterator>& x);
template<class Iterator>
constexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i);
template<class Iterator1, class Iterator2>
requires (!sized_sentinel_for<Iterator1, Iterator2>)
inline constexpr bool disable_sized_sentinel_for<reverse_iterator<Iterator1>,reverse_iterator<Iterator2>> = true;
// 25.5.2, insert iterators
template<class Container> class back_insert_iterator;
template<class Container>
constexpr back_insert_iterator<Container> back_inserter(Container& x);
template<class Container> class front_insert_iterator;
template<class Container>
constexpr front_insert_iterator<Container> front_inserter(Container& x);
template<class Container> class insert_iterator;
template<class Container>
constexpr insert_iterator<Container>
inserter(Container& x, ranges::iterator_t<Container> i);
// 25.5.3, move iterators and sentinels template<class Iterator> class move_iterator;
template<class Iterator1, class Iterator2>
constexpr bool operator==(
    const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator<(
    const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator>(
    const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator<=(
    const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr bool operator>=(
    const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const move_iterator<Iterator1>& x,
            const move_iterator<Iterator2>& y);
template<class Iterator1, class Iterator2>
constexpr auto operator-(
    const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y)
-> decltype(x.base() - y.base());
template<class Iterator>
constexpr move_iterator<Iterator>
operator+(iter_difference_t<Iterator> n, const move_iterator<Iterator>& x);
template<class Iterator>
constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
template<semiregular S> class move_sentinel;
// 25.5.4, common iterators template<input_or_output_iterator I, sentinel_for<I> S>
requires (!same_as<I, S> && copyable<I>)
class common_iterator;
template<class I, class S>
struct incrementable_traits<common_iterator<I, S>>;
template<input_iterator I, class S>
struct iterator_traits<common_iterator<I, S>>;
// 25.5.5, default sentinel
struct default_sentinel_t;
inline constexpr default_sentinel_t default_sentinel{};
// 25.5.6, counted iterators
template<input_or_output_iterator I> class counted_iterator;
template<input_iterator I>
requires see_below
struct iterator_traits<counted_iterator<I>>;
// 25.5.7, unreachable sentinel
struct unreachable_sentinel_t;
inline constexpr unreachable_sentinel_t unreachable_sentinel{};
// 25.6, stream iterators
template<class T, class charT = char, class traits = char_traits<charT>,
         class Distance = ptrdiff_t>
class istream_iterator;
template<class T, class charT, class traits, class Distance>
bool operator==(const istream_iterator<T,charT,traits,Distance>& x,
                const istream_iterator<T,charT,traits,Distance>& y);
template<class T, class charT = char, class traits = char_traits<charT>>
class ostream_iterator;
template<class charT, class traits = char_traits<charT>>
class istreambuf_iterator;
template<class charT, class traits>
bool operator==(const istreambuf_iterator<charT,traits>& a,
                const istreambuf_iterator<charT,traits>& b);
template<class charT, class traits = char_traits<charT>>
class ostreambuf_iterator;
// 25.7, range access
template<class C> constexpr auto begin(C& c) -> decltype(c.begin());
template<class C> constexpr auto begin(const C& c) -> decltype(c.begin());
template<class C> constexpr auto end(C& c) -> decltype(c.end());
template<class C> constexpr auto end(const C& c) -> decltype(c.end());
template<class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept;
template<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept;
template<class C> constexpr auto cbegin(const C& c) noexcept(noexcept(std::begin(c)))
-> decltype(std::begin(c));
template<class C> constexpr auto cend(const C& c) noexcept(noexcept(std::end(c)))
-> decltype(std::end(c));
template<class C> constexpr auto rbegin(C& c) -> decltype(c.rbegin());
template<class C> constexpr auto rbegin(const C& c) -> decltype(c.rbegin());
template<class C> constexpr auto rend(C& c) -> decltype(c.rend());
template<class C> constexpr auto rend(const C& c) -> decltype(c.rend());
template<class T, size_t N> constexpr reverse_iterator<T*> rbegin(T (&array)[N]);
template<class T, size_t N> constexpr reverse_iterator<T*> rend(T (&array)[N]);
template<class E> constexpr reverse_iterator<const E*> rbegin(initializer_list<E> il);
template<class E> constexpr reverse_iterator<const E*> rend(initializer_list<E> il);
template<class C> constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c));
template<class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));
template<class C> constexpr auto size(const C& c) -> decltype(c.size());
template<class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept;
template<class C> constexpr auto ssize(const C& c)
-> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>;
template<class T, ptrdiff_t N> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept;
template<class C> [[nodiscard]] constexpr auto empty(const C& c) -> decltype(c.empty());
template<class T, size_t N> [[nodiscard]] constexpr bool empty(const T (&array)[N]) noexcept;
template<class E> [[nodiscard]] constexpr bool empty(initializer_list<E> il) noexcept;
template<class C> constexpr auto data(C& c) -> decltype(c.data());
template<class C> constexpr auto data(const C& c) -> decltype(c.data());
template<class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;
template<class E> constexpr const E* data(initializer_list<E> il) noexcept;
}
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}
```

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

```ubuntu:bash
$ clang++ p967.cpp -std=03 -o p967l -I. -Wall
In file included from p967.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 \
 ^
p967.cpp:19:18: error: declaration of 'T' shadows template parameter
  template<class T>
                 ^
p967.cpp:18:18: note: template parameter is declared here
  template<class T>
                 ^
p967.cpp:21:1: error: cannot template a using declaration
using with-reference = T&; // exposition only
^
p967.cpp:21:11: error: expected external declaration
using with-reference = T&; // exposition only
          ^
p967.cpp:21:12: error: C++ requires a type specifier for all declarations
using with-reference = T&; // exposition only
           ^
p967.cpp:21:26: error: expected expression
using with-reference = T&; // exposition only
                         ^
p967.cpp:21:24: error: use of undeclared identifier 'T'
using with-reference = T&; // exposition only
                       ^
p967.cpp:22:1: error: unknown type name 'concept'
concept can-reference // exposition only = requires { typename with-reference<T>; };
^
p967.cpp:22:12: error: expected ';' after top level declarator
concept can-reference // exposition only = requires { typename with-reference<T>; };
           ^
           ;
p967.cpp:28:27: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using iter_difference_t = see_below;
                          ^
p967.cpp:28:27: error: unknown type name 'see_below'
p967.cpp:31:22: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using iter_value_t = see_below;
                     ^
p967.cpp:31:22: error: unknown type name 'see_below'
p967.cpp:34:19: error: unknown type name 'requires'
template<class T> requires is_object_v<T> struct iterator_traits<T*>;
                  ^
p967.cpp:34:28: error: no variable template matches partial specialization
template<class T> requires is_object_v<T> struct iterator_traits<T*>;
                           ^
p967.cpp:34:42: error: expected ';' at end of declaration
template<class T> requires is_object_v<T> struct iterator_traits<T*>;
                                         ^
                                         ;
p967.cpp:34:66: error: use of undeclared identifier 'T'
template<class T> requires is_object_v<T> struct iterator_traits<T*>;
                                                                 ^
p967.cpp:34:68: error: expected expression
template<class T> requires is_object_v<T> struct iterator_traits<T*>;
                                                                   ^
p967.cpp:35:10: error: unknown type name 'dereferenceable'
template<dereferenceable T>
         ^
p967.cpp:36:26: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using iter_reference_t = decltype(*declval<T&>());
                         ^
p967.cpp:36:26: error: unknown type name 'decltype'
p967.cpp:36:46: error: expected expression
using iter_reference_t = decltype(*declval<T&>());
                                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
$ clang++ p967.cpp -std=2b -o p967l -I. -Wall
p967.cpp:19:18: error: declaration of 'T' shadows template parameter
  template<class T>
                 ^
p967.cpp:18:18: note: template parameter is declared here
  template<class T>
                 ^
p967.cpp:21:1: error: cannot template a using declaration
using with-reference = T&; // exposition only
^
p967.cpp:21:11: error: expected external declaration
using with-reference = T&; // exposition only
          ^
p967.cpp:21:12: error: no template named 'reference'; did you mean 'is_reference'?
using with-reference = T&; // exposition only
           ^~~~~~~~~
           is_reference
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:527:12: note: 'is_reference' declared here
    struct is_reference
           ^
p967.cpp:21:12: error: '<deduction guide for is_reference>' cannot be the name of a variable or data member
using with-reference = T&; // exposition only
           ^
p967.cpp:21:26: error: expected expression
using with-reference = T&; // exposition only
                         ^
p967.cpp:21:24: error: use of undeclared identifier 'T'
using with-reference = T&; // exposition only
                       ^
p967.cpp:22:1: error: expected unqualified-id
concept can-reference // exposition only = requires { typename with-reference<T>; };
^
p967.cpp:24:8: error: cannot use arrow operator on a type
{ *t } -> can-reference ; // not required to be equality-preserving };
       ^
p967.cpp:28:27: error: unknown type name 'see_below'
using iter_difference_t = see_below;
                          ^
p967.cpp:31:22: error: unknown type name 'see_below'
using iter_value_t = see_below;
                     ^
p967.cpp:35:10: error: unknown type name 'dereferenceable'
template<dereferenceable T>
         ^
p967.cpp:36:46: error: expected expression
using iter_reference_t = decltype(*declval<T&>());
                                             ^
p967.cpp:40:1: error: C++ requires a type specifier for all declarations
iter_move =
^
p967.cpp:41:1: error: use of undeclared identifier 'unspecified'
unspecified ;
^
p967.cpp:43:10: error: unknown type name 'dereferenceable'
template<dereferenceable T> requires requires(T& t) {
         ^
p967.cpp:43:47: error: unknown type name 'T'
template<dereferenceable T> requires requires(T& t) {
                                              ^
p967.cpp:45:3: error: use of undeclared identifier 'unspecified'
= unspecified ;
  ^
p967.cpp:47:1: error: expected unqualified-id
{ ranges::iter_move(t) } -> cans_reference; }
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p967.cpp -std=03 -o p967g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p967.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 \
      |  ^~~~~
p967.cpp:36:26: warning: identifier 'decltype' is a keyword in C++11 [-Wc++11-compat]
   36 | using iter_reference_t = decltype(*declval<T&>());
      |                          ^~~~~~~~
p967.cpp:67:10: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   67 |   inline constexpr bool disable_sized_sentinel_for = false;
      |          ^~~~~~~~~
p967.cpp:288:63: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
  288 | template<class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept; template<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept;
      |                                                               ^~~~~~~~
p967.cpp:19:12: error: declaration of template parameter 'T' shadows template parameter
   19 |   template<class T>
      |            ^~~~~
p967.cpp:18:12: note: template parameter 'T' declared here
   18 |   template<class T>
      |            ^~~~~
p967.cpp:21:1: error: expected unqualified-id before 'using'
   21 | using with-reference = T&; // exposition only
      | ^~~~~
p967.cpp:22:1: error: 'concept' does not name a type
   22 | concept can-reference // exposition only = requires { typename with-reference<T>; };
      | ^~~~~~~
p967.cpp:22:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:24:8: error: expected unqualified-id before '->' token
   24 | { *t } -> can-reference ; // not required to be equality-preserving };
      |        ^~
p967.cpp:28:1: error: expected unqualified-id before 'using'
   28 | using iter_difference_t = see_below;
      | ^~~~~
p967.cpp:31:1: error: expected unqualified-id before 'using'
   31 | using iter_value_t = see_below;
      | ^~~~~
p967.cpp:34:19: error: 'requires' does not name a type
   34 | template<class T> requires is_object_v<T> struct iterator_traits<T*>;
      |                   ^~~~~~~~
p967.cpp:34:19: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p967.cpp:35:10: error: 'dereferenceable' has not been declared
   35 | template<dereferenceable T>
      |          ^~~~~~~~~~~~~~~
p967.cpp:36:1: error: expected unqualified-id before 'using'
   36 | using iter_reference_t = decltype(*declval<T&>());
      | ^~~~~
p967.cpp:40:1: error: 'iter_move' does not name a type
   40 | iter_move =
      | ^~~~~~~~~
p967.cpp:43:10: error: 'dereferenceable' has not been declared
   43 | template<dereferenceable T> requires requires(T& t) {
      |          ^~~~~~~~~~~~~~~
p967.cpp:43:29: error: 'requires' does not name a type
   43 | template<dereferenceable T> requires requires(T& t) {
      |                             ^~~~~~~~
p967.cpp:43:29: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p967.cpp:47:1: error: expected unqualified-id before '{' token
   47 | { ranges::iter_move(t) } -> cans_reference; }
      | ^
p967.cpp:47:26: error: expected unqualified-id before '->' token
   47 | { ranges::iter_move(t) } -> cans_reference; }
      |                          ^~
p967.cpp:48:7: error: expected nested-name-specifier before 'iter_rvalue_reference_t'
   48 | using iter_rvalue_reference_t
      |       ^~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:52:1: error: 'concept' does not name a type; did you mean 'const'?
   52 | concept indirectly_readable = see_below;
      | ^~~~~~~
      | const
p967.cpp:52:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:53:10: error: 'indirectly_readable' has not been declared
   53 | template<indirectly_readable T>
      |          ^~~~~~~~~~~~~~~~~~~
p967.cpp:54:3: error: expected unqualified-id before 'using'
   54 |   using iter_common_reference_t =
      |   ^~~~~
p967.cpp:57:1: error: 'concept' does not name a type; did you mean 'const'?
   57 | concept indirectly_writable = see_below;
      | ^~~~~~~
      | const
p967.cpp:57:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:59:1: error: 'concept' does not name a type; did you mean 'const'?
   59 | concept weakly_incrementable = see_below;
      | ^~~~~~~
      | const
p967.cpp:59:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:61:1: error: 'concept' does not name a type; did you mean 'const'?
   61 | concept incrementable = see_below;
      | ^~~~~~~
      | const
p967.cpp:61:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:63:1: error: 'concept' does not name a type; did you mean 'const'?
   63 | concept input_or_output_iterator = see_below;
      | ^~~~~~~
      | const
p967.cpp:63:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:65:1: error: 'concept' does not name a type; did you mean 'const'?
   65 | concept sentinel_for = see_below;
      | ^~~~~~~
      | const
p967.cpp:65:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:67:10: error: 'constexpr' does not name a type
   67 |   inline constexpr bool disable_sized_sentinel_for = false;
      |          ^~~~~~~~~
p967.cpp:67:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:69:1: error: 'concept' does not name a type; did you mean 'const'?
   69 | concept sized_sentinel_for = see_below;
      | ^~~~~~~
      | const
p967.cpp:69:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:71:1: error: 'concept' does not name a type; did you mean 'const'?
   71 | concept input_iterator = see_below;
      | ^~~~~~~
      | const
p967.cpp:71:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:73:1: error: 'concept' does not name a type; did you mean 'const'?
   73 | concept output_iterator = see_below;
      | ^~~~~~~
      | const
p967.cpp:73:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:75:1: error: 'concept' does not name a type; did you mean 'const'?
   75 | concept forward_iterator = see_below;
      | ^~~~~~~
      | const
p967.cpp:75:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:77:1: error: 'concept' does not name a type; did you mean 'const'?
   77 | concept bidirectional_iterator = see_below;
      | ^~~~~~~
      | const
p967.cpp:77:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:79:1: error: 'concept' does not name a type; did you mean 'const'?
   79 | concept random_access_iterator = see_below;
      | ^~~~~~~
      | const
p967.cpp:79:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:81:1: error: 'concept' does not name a type; did you mean 'const'?
   81 | concept contiguous_iterator = see_below;
      | ^~~~~~~
      | const
p967.cpp:81:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:83:1: error: 'concept' does not name a type; did you mean 'const'?
   83 | concept indirectly_unary_invocable = see_below; template<class F, class I>
      | ^~~~~~~
      | const
p967.cpp:83:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:84:1: error: 'concept' does not name a type; did you mean 'const'?
   84 | concept indirectly_regular_unary_invocable = see_below; template<class F, class I>
      | ^~~~~~~
      | const
p967.cpp:84:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:85:1: error: 'concept' does not name a type; did you mean 'const'?
   85 | concept indirect_unary_predicate = see_below; template<class F, class I1, class I2>
      | ^~~~~~~
      | const
p967.cpp:85:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:86:1: error: 'concept' does not name a type; did you mean 'const'?
   86 | concept indirect_binary_predicate = see_below; template<class F, class I1, class I2 = I1>
      | ^~~~~~~
      | const
p967.cpp:86:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:87:1: error: 'concept' does not name a type; did you mean 'const'?
   87 | concept indirect_equivalence_relation = see_below; template<class F, class I1, class I2 = I1>
      | ^~~~~~~
      | const
p967.cpp:87:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:88:1: error: 'concept' does not name a type; did you mean 'const'?
   88 | concept indirect_strict_weak_order = see_below;
      | ^~~~~~~
      | const
p967.cpp:88:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:89:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   89 | template<class F, class... Is>
      |                        ^~~
p967.cpp:90:12: error: expected constructor, destructor, or type conversion before '(' token
   90 |   requires (indirectly_readable<Is> && ...) && invocable<F, iter_reference_t<Is>...>
      |            ^
p967.cpp:93:10: error: 'indirectly_readable' has not been declared
   93 | template<indirectly_readable I, indirectly_regular_unary_invocable<I> Proj>
      |          ^~~~~~~~~~~~~~~~~~~
p967.cpp:93:33: error: 'indirectly_regular_unary_invocable' has not been declared
   93 | template<indirectly_readable I, indirectly_regular_unary_invocable<I> Proj>
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:93:67: error: expected '>' before '<' token
   93 | template<indirectly_readable I, indirectly_regular_unary_invocable<I> Proj>
      |                                                                   ^
p967.cpp:94:10: error: no default argument for '<anonymous>'
   94 |   struct projected;
      |          ^~~~~~~~~
p967.cpp:95:10: error: 'weakly_incrementable' has not been declared
   95 | template<weakly_incrementable I, class Proj>
      |          ^~~~~~~~~~~~~~~~~~~~
p967.cpp:96:41: error: 'I' was not declared in this scope
   96 |   struct incrementable_traits<projected<I, Proj>>;
      |                                         ^
p967.cpp:96:48: error: '>>' should be '> >' within a nested template argument list
   96 |   struct incrementable_traits<projected<I, Proj>>;
      |                                                ^~
      |                                                > >
p967.cpp:96:44: error: template argument 1 is invalid
   96 |   struct incrementable_traits<projected<I, Proj>>;
      |                                            ^~~~
p967.cpp:96:44: error: type/value mismatch at argument 2 in template parameter list for 'template<<declaration error>, <typeprefixerror><anonymous> > struct projected'
p967.cpp:96:44: note:   expected a constant of type '<type error>', got 'Proj'
p967.cpp:96:48: error: template argument 1 is invalid
   96 |   struct incrementable_traits<projected<I, Proj>>;
      |                                                ^~
p967.cpp:98:1: error: 'concept' does not name a type; did you mean 'const'?
   98 | concept indirectly_movable = see_below; template<class In, class Out>
      | ^~~~~~~
      | const
p967.cpp:98:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:99:1: error: 'concept' does not name a type; did you mean 'const'?
   99 | concept indirectly_movable_storable = see_below;
      | ^~~~~~~
      | const
p967.cpp:99:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:101:1: error: 'concept' does not name a type; did you mean 'const'?
  101 | concept indirectly_copyable = see_below; template<class In, class Out>
      | ^~~~~~~
      | const
p967.cpp:101:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:102:1: error: 'concept' does not name a type; did you mean 'const'?
  102 | concept indirectly_copyable_storable = see_below;
      | ^~~~~~~
      | const
p967.cpp:102:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:104:1: error: 'concept' does not name a type; did you mean 'const'?
  104 | concept indirectly_swappable = see_below;
      | ^~~~~~~
      | const
p967.cpp:104:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:106:50: error: 'identity' does not name a type
  106 | template<class I1, class I2, class R, class P1 = identity, class P2 = identity>
      |                                                  ^~~~~~~~
p967.cpp:106:71: error: 'identity' does not name a type
  106 | template<class I1, class I2, class R, class P1 = identity, class P2 = identity>
      |                                                                       ^~~~~~~~
p967.cpp:107:1: error: 'concept' does not name a type; did you mean 'const'?
  107 | concept indirectly_comparable = see_below;
      | ^~~~~~~
      | const
p967.cpp:107:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:109:1: error: 'concept' does not name a type; did you mean 'const'?
  109 | concept permutable = see_below;
      | ^~~~~~~
      | const
p967.cpp:109:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:111:9: error: expected unqualified-id before '=' token
  111 | class R = ranges::less, class P1 = identity, class P2 = identity> concept mergeable = see_below;
      |         ^
p967.cpp:113:37: error: 'less' in namespace 'std::ranges' does not name a type
  113 | template<class I, class R = ranges::less, class P = identity>
      |                                     ^~~~
p967.cpp:113:53: error: 'identity' does not name a type
  113 | template<class I, class R = ranges::less, class P = identity>
      |                                                     ^~~~~~~~
p967.cpp:114:1: error: 'concept' does not name a type; did you mean 'const'?
  114 | concept sortable = see_below;
      | ^~~~~~~
      | const
p967.cpp:114:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p967.cpp:119:37: error: reference to 'input_iterator_tag' is ambiguous
  119 | struct forward_iterator_tag: public input_iterator_tag { };
      |                                     ^~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/string:45,
                 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:
/usr/local/include/c++/12.1.0/bits/stl_iterator_base_types.h:93:10: note: candidates are: 'struct std::input_iterator_tag'
   93 |   struct input_iterator_tag { };
      |          ^~~~~~~~~~~~~~~~~~
p967.cpp:117:8: note:                 'struct input_iterator_tag'
  117 | struct input_iterator_tag { };
      |        ^~~~~~~~~~~~~~~~~~
p967.cpp:120:43: error: reference to 'forward_iterator_tag' is ambiguous
  120 | struct bidirectional_iterator_tag: public forward_iterator_tag { }; struct random_access_iterator_tag: public bidirectional_iterator_tag { }; struct contiguous_iterator_tag: public random_access_iterator_tag { };
      |                                           ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator_base_types.h:99:10: note: candidates are: 'struct std::forward_iterator_tag'
   99 |   struct forward_iterator_tag : public input_iterator_tag { };
      |          ^~~~~~~~~~~~~~~~~~~~
p967.cpp:119:8: note:                 'struct forward_iterator_tag'
  119 | struct forward_iterator_tag: public input_iterator_tag { };
      |        ^~~~~~~~~~~~~~~~~~~~
p967.cpp:120:111: error: reference to 'bidirectional_iterator_tag' is ambiguous
  120 | terator_tag: public forward_iterator_tag { }; struct random_access_iterator_tag: public bidirectional_iterator_tag { }; struct contiguous_iterator_tag: public random_access_iterator_tag { };
      |                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/local/include/c++/12.1.0/bits/stl_iterator_base_types.h:103:10: note: candidates are: 'struct std::bidirectional_iterator_tag'
  103 |   struct bidirectional_iterator_tag : public forward_iterator_tag { };
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:120:8: note:                 'struct bidirectional_iterator_tag'
  120 | struct bidirectional_iterator_tag: public forward_iterator_tag { }; struct random_access_iterator_tag: public bidirectional_iterator_tag { }; struct contiguous_iterator_tag: public random_access_iterator_tag { };
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:120:182: error: reference to 'random_access_iterator_tag' is ambiguous
  120 | ator_tag: public bidirectional_iterator_tag { }; struct contiguous_iterator_tag: public random_access_iterator_tag { };
      |                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/local/include/c++/12.1.0/bits/stl_iterator_base_types.h:107:10: note: candidates are: 'struct std::random_access_iterator_tag'
  107 |   struct random_access_iterator_tag : public bidirectional_iterator_tag { };
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:120:76: note:                 'struct random_access_iterator_tag'
  120 | struct bidirectional_iterator_tag: public forward_iterator_tag { }; struct random_access_iterator_tag: public bidirectional_iterator_tag { }; struct contiguous_iterator_tag: public random_access_iterator_tag { };
      |                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:123:3: error: 'constexpr' does not name a type
  123 |   constexpr void
      |   ^~~~~~~~~
p967.cpp:123:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:126:3: error: 'constexpr' does not name a type
  126 |   constexpr typename iterator_traits<InputIterator>::difference_type
      |   ^~~~~~~~~
p967.cpp:126:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:129:3: error: 'constexpr' does not name a type
  129 |   constexpr InputIterator
      |   ^~~~~~~~~
p967.cpp:129:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:133:3: error: 'constexpr' does not name a type
  133 |   constexpr BidirectionalIterator
      |   ^~~~~~~~~
p967.cpp:133:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:138:5: error: 'constexpr' does not name a type
  138 |     constexpr void advance(I& i, iter_difference_t<I> n);
      |     ^~~~~~~~~
p967.cpp:138:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:139:12: error: 'input_or_output_iterator' has not been declared
  139 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:139:40: error: 'sentinel_for' has not been declared
  139 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                        ^~~~~~~~~~~~
p967.cpp:139:52: error: expected '>' before '<' token
  139 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                                    ^
p967.cpp:140:5: error: 'constexpr' does not name a type
  140 |     constexpr void advance(I& i, S bound);
      |     ^~~~~~~~~
p967.cpp:140:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:141:12: error: 'input_or_output_iterator' has not been declared
  141 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:141:40: error: 'sentinel_for' has not been declared
  141 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                        ^~~~~~~~~~~~
p967.cpp:141:52: error: expected '>' before '<' token
  141 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                                    ^
p967.cpp:142:5: error: 'constexpr' does not name a type
  142 |     constexpr iter_difference_t<I> advance(I& i, iter_difference_t<I> n, S bound);
      |     ^~~~~~~~~
p967.cpp:142:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:144:14: error: expected constructor, destructor, or type conversion before '(' token
  144 |     requires (!sized_sentinel_for<S, I>)
      |              ^
p967.cpp:146:12: error: 'input_or_output_iterator' has not been declared
  146 |   template<input_or_output_iterator I, sized_sentinel_for<I> S>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:146:40: error: 'sized_sentinel_for' has not been declared
  146 |   template<input_or_output_iterator I, sized_sentinel_for<I> S>
      |                                        ^~~~~~~~~~~~~~~~~~
p967.cpp:146:58: error: expected '>' before '<' token
  146 |   template<input_or_output_iterator I, sized_sentinel_for<I> S>
      |                                                          ^
p967.cpp:147:5: error: 'constexpr' does not name a type
  147 |     constexpr iter_difference_t<I> distance(const I& first, const S& last);
      |     ^~~~~~~~~
p967.cpp:147:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:148:12: error: 'range' has not been declared
  148 |   template<range R>
      |            ^~~~~
p967.cpp:149:5: error: 'constexpr' does not name a type
  149 |     constexpr range_difference_t<R> distance(R&& r);
      |     ^~~~~~~~~
p967.cpp:149:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:151:5: error: 'constexpr' does not name a type
  151 |     constexpr I next(I x);
      |     ^~~~~~~~~
p967.cpp:151:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:152:12: error: 'input_or_output_iterator' has not been declared
  152 |   template<input_or_output_iterator I>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:153:5: error: 'constexpr' does not name a type
  153 |     constexpr I next(I x, iter_difference_t<I> n);
      |     ^~~~~~~~~
p967.cpp:153:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:154:12: error: 'input_or_output_iterator' has not been declared
  154 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:154:40: error: 'sentinel_for' has not been declared
  154 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                        ^~~~~~~~~~~~
p967.cpp:154:52: error: expected '>' before '<' token
  154 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                                    ^
p967.cpp:155:1: error: 'constexpr' does not name a type
  155 | constexpr I next(I x, S bound);
      | ^~~~~~~~~
p967.cpp:155:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:156:12: error: 'input_or_output_iterator' has not been declared
  156 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:156:40: error: 'sentinel_for' has not been declared
  156 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                        ^~~~~~~~~~~~
p967.cpp:156:52: error: expected '>' before '<' token
  156 |   template<input_or_output_iterator I, sentinel_for<I> S>
      |                                                    ^
p967.cpp:157:5: error: 'constexpr' does not name a type
  157 |     constexpr I next(I x, iter_difference_t<I> n, S bound);
      |     ^~~~~~~~~
p967.cpp:157:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:159:5: error: 'constexpr' does not name a type
  159 |     constexpr I prev(I x);
      |     ^~~~~~~~~
p967.cpp:159:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:160:12: error: 'bidirectional_iterator' has not been declared
  160 |   template<bidirectional_iterator I>
      |            ^~~~~~~~~~~~~~~~~~~~~~
p967.cpp:161:5: error: 'constexpr' does not name a type
  161 |     constexpr I prev(I x, iter_difference_t<I> n);
      |     ^~~~~~~~~
p967.cpp:161:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:162:12: error: 'bidirectional_iterator' has not been declared
  162 |   template<bidirectional_iterator I>
      |            ^~~~~~~~~~~~~~~~~~~~~~
p967.cpp:163:5: error: 'constexpr' does not name a type
  163 |     constexpr I prev(I x, iter_difference_t<I> n, I bound);
      |     ^~~~~~~~~
p967.cpp:163:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:164:1: error: expected declaration before '}' token
  164 | }
      | ^
p967.cpp:169:3: error: 'constexpr' does not name a type
  169 |   constexpr bool operator==(
      |   ^~~~~~~~~
p967.cpp:169:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:173:3: error: 'constexpr' does not name a type
  173 |   constexpr bool operator!=(
      |   ^~~~~~~~~
p967.cpp:173:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:177:3: error: 'constexpr' does not name a type
  177 |   constexpr bool operator<(
      |   ^~~~~~~~~
p967.cpp:177:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:181:3: error: 'constexpr' does not name a type
  181 |   constexpr bool operator>(
      |   ^~~~~~~~~
p967.cpp:181:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:185:3: error: 'constexpr' does not name a type
  185 |   constexpr bool operator<=(
      |   ^~~~~~~~~
p967.cpp:185:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:189:3: error: 'constexpr' does not name a type
  189 |   constexpr bool operator>=(
      |   ^~~~~~~~~
p967.cpp:189:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:192:27: error: 'three_way_comparable_with' has not been declared
  192 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:192:52: error: expected '>' before '<' token
  192 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
      |                                                    ^
p967.cpp:193:3: error: 'constexpr' does not name a type
  193 |   constexpr compare_three_way_result_t<Iterator1, Iterator2>
      |   ^~~~~~~~~
p967.cpp:193:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:197:3: error: 'constexpr' does not name a type
  197 |   constexpr auto operator-(
      |   ^~~~~~~~~
p967.cpp:197:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:201:3: error: 'constexpr' does not name a type
  201 |   constexpr reverse_iterator<Iterator> operator+(
      |   ^~~~~~~~~
p967.cpp:201:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:205:3: error: 'constexpr' does not name a type
  205 |   constexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i);
      |   ^~~~~~~~~
p967.cpp:205:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:207:14: error: expected constructor, destructor, or type conversion before '(' token
  207 |     requires (!sized_sentinel_for<Iterator1, Iterator2>)
      |              ^
p967.cpp:212:3: error: 'constexpr' does not name a type
  212 |   constexpr back_insert_iterator<Container> back_inserter(Container& x);
      |   ^~~~~~~~~
p967.cpp:212:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:215:3: error: 'constexpr' does not name a type
  215 |   constexpr front_insert_iterator<Container> front_inserter(Container& x);
      |   ^~~~~~~~~
p967.cpp:215:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:218:3: error: 'constexpr' does not name a type
  218 |   constexpr insert_iterator<Container>
      |   ^~~~~~~~~
p967.cpp:218:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:222:3: error: 'constexpr' does not name a type
  222 |   constexpr bool operator==(
      |   ^~~~~~~~~
p967.cpp:222:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:225:3: error: 'constexpr' does not name a type
  225 |   constexpr bool operator<(
      |   ^~~~~~~~~
p967.cpp:225:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:228:3: error: 'constexpr' does not name a type
  228 |   constexpr bool operator>(
      |   ^~~~~~~~~
p967.cpp:228:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:231:3: error: 'constexpr' does not name a type
  231 |   constexpr bool operator<=(
      |   ^~~~~~~~~
p967.cpp:231:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:234:3: error: 'constexpr' does not name a type
  234 |   constexpr bool operator>=(
      |   ^~~~~~~~~
p967.cpp:234:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:236:27: error: 'three_way_comparable_with' has not been declared
  236 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:236:52: error: expected '>' before '<' token
  236 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
      |                                                    ^
p967.cpp:237:3: error: 'constexpr' does not name a type
  237 |   constexpr compare_three_way_result_t<Iterator1, Iterator2>
      |   ^~~~~~~~~
p967.cpp:237:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:241:3: error: 'constexpr' does not name a type
  241 |   constexpr auto operator-(
      |   ^~~~~~~~~
p967.cpp:241:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:245:3: error: 'constexpr' does not name a type
  245 |   constexpr move_iterator<Iterator>
      |   ^~~~~~~~~
p967.cpp:245:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:248:3: error: 'constexpr' does not name a type
  248 |   constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
      |   ^~~~~~~~~
p967.cpp:248:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:249:10: error: 'semiregular' has not been declared
  249 | template<semiregular S> class move_sentinel;
      |          ^~~~~~~~~~~
p967.cpp:251:12: error: expected constructor, destructor, or type conversion before '(' token
  251 |   requires (!same_as<I, S> && copyable<I>)
      |            ^
p967.cpp:254:31: error: 'common_iterator' was not declared in this scope
  254 |   struct incrementable_traits<common_iterator<I, S>>;
      |                               ^~~~~~~~~~~~~~~
p967.cpp:254:51: error: spurious '>>', use '>' to terminate a template argument list
  254 |   struct incrementable_traits<common_iterator<I, S>>;
      |                                                   ^~
p967.cpp:254:51: error: wrong number of template arguments (2, should be 1)
p967.cpp:27:24: note: provided for 'template<class> struct std::incrementable_traits'
   27 | template<class> struct incrementable_traits; template<class T>
      |                        ^~~~~~~~~~~~~~~~~~~~
p967.cpp:255:10: error: 'input_iterator' has not been declared
  255 | template<input_iterator I, class S>
      |          ^~~~~~~~~~~~~~
p967.cpp:256:26: error: 'common_iterator' was not declared in this scope
  256 |   struct iterator_traits<common_iterator<I, S>>;
      |                          ^~~~~~~~~~~~~~~
p967.cpp:256:42: error: 'I' was not declared in this scope
  256 |   struct iterator_traits<common_iterator<I, S>>;
      |                                          ^
p967.cpp:256:46: error: spurious '>>', use '>' to terminate a template argument list
  256 |   struct iterator_traits<common_iterator<I, S>>;
      |                                              ^~
p967.cpp:256:46: error: wrong number of template arguments (2, should be 1)
In file included from /usr/local/include/c++/12.1.0/string:42:
/usr/local/include/c++/12.1.0/bits/cpp_type_traits.h:425:29: note: provided for 'template<class> struct std::iterator_traits'
  425 |   template<typename> struct iterator_traits;
      |                             ^~~~~~~~~~~~~~~
p967.cpp:259:8: error: 'constexpr' does not name a type
  259 | inline constexpr default_sentinel_t default_sentinel{};
      |        ^~~~~~~~~
p967.cpp:259:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:261:10: error: 'input_or_output_iterator' has not been declared
  261 | template<input_or_output_iterator I> class counted_iterator;
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:262:10: error: 'input_iterator' has not been declared
  262 | template<input_iterator I>
      |          ^~~~~~~~~~~~~~
p967.cpp:263:1: error: 'requires' does not name a type
  263 | requires see_below
      | ^~~~~~~~
p967.cpp:263:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p967.cpp:267:8: error: 'constexpr' does not name a type
  267 | inline constexpr unreachable_sentinel_t unreachable_sentinel{};
      |        ^~~~~~~~~
p967.cpp:267:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:275:71: error: spurious '>>', use '>' to terminate a template argument list
  275 | template<class T, class charT = char, class traits = char_traits<charT>>
      |                                                                       ^~
p967.cpp:275:54: error: two or more data types in declaration of 'type name'
  275 | template<class T, class charT = char, class traits = char_traits<charT>>
      |                                                      ^~~~~~~~~~~~~~~~~~~
p967.cpp:276:27: error: expected '>' before ';' token
  276 |     class ostream_iterator;
      |                           ^
p967.cpp:276:27: error: expected unqualified-id before ';' token
p967.cpp:277:55: error: spurious '>>', use '>' to terminate a template argument list
  277 | template<class charT, class traits = char_traits<charT>>
      |                                                       ^~
p967.cpp:278:9: error: template argument required for 'class istreambuf_iterator'
  278 |   class istreambuf_iterator;
      |         ^~~~~~~~~~~~~~~~~~~
p967.cpp:277:38: error: two or more data types in declaration of 'type name'
  277 | template<class charT, class traits = char_traits<charT>>
      |                                      ^~~~~~~~~~~~~~~~~~~
p967.cpp:278:28: error: expected '>' before ';' token
  278 |   class istreambuf_iterator;
      |                            ^
p967.cpp:278:28: error: expected unqualified-id before ';' token
p967.cpp:282:55: error: spurious '>>', use '>' to terminate a template argument list
  282 | template<class charT, class traits = char_traits<charT>>
      |                                                       ^~
p967.cpp:283:9: error: template argument required for 'class ostreambuf_iterator'
  283 |   class ostreambuf_iterator;
      |         ^~~~~~~~~~~~~~~~~~~
p967.cpp:282:38: error: two or more data types in declaration of 'type name'
  282 | template<class charT, class traits = char_traits<charT>>
      |                                      ^~~~~~~~~~~~~~~~~~~
p967.cpp:283:28: error: expected '>' before ';' token
  283 |   class ostreambuf_iterator;
      |                            ^
p967.cpp:283:28: error: expected unqualified-id before ';' token
p967.cpp:285:19: error: 'constexpr' does not name a type
  285 | template<class C> constexpr auto begin(C& c) -> decltype(c.begin());
      |                   ^~~~~~~~~
p967.cpp:285:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:286:19: error: 'constexpr' does not name a type
  286 | template<class C> constexpr auto begin(const C& c) -> decltype(c.begin()); template<class C> constexpr auto end(C& c) -> decltype(c.end());
      |                   ^~~~~~~~~
p967.cpp:286:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:286:94: error: 'constexpr' does not name a type
  286 | ate<class C> constexpr auto begin(const C& c) -> decltype(c.begin()); template<class C> constexpr auto end(C& c) -> decltype(c.end());
      |                                                                                         ^~~~~~~~~

p967.cpp:286:94: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:287:19: error: 'constexpr' does not name a type
  287 | template<class C> constexpr auto end(const C& c) -> decltype(c.end());
      |                   ^~~~~~~~~
p967.cpp:287:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:288:29: error: 'constexpr' does not name a type
  288 | template<class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept; template<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept;
      |                             ^~~~~~~~~
p967.cpp:288:29: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:288:101: error: 'constexpr' does not name a type
  288 | ss T, size_t N> constexpr T* begin(T (&array)[N]) noexcept; template<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept;
      |                                                                                         ^~~~~~~~~

p967.cpp:288:101: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:289:19: error: 'constexpr' does not name a type
  289 | template<class C> constexpr auto cbegin(const C& c) noexcept(noexcept(std::begin(c)))
      |                   ^~~~~~~~~
p967.cpp:289:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:291:19: error: 'constexpr' does not name a type
  291 | template<class C> constexpr auto cend(const C& c) noexcept(noexcept(std::end(c)))
      |                   ^~~~~~~~~
p967.cpp:291:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:293:19: error: 'constexpr' does not name a type
  293 | template<class C> constexpr auto rbegin(C& c) -> decltype(c.rbegin());
      |                   ^~~~~~~~~
p967.cpp:293:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:294:19: error: 'constexpr' does not name a type
  294 | template<class C> constexpr auto rbegin(const C& c) -> decltype(c.rbegin());
      |                   ^~~~~~~~~
p967.cpp:294:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:295:19: error: 'constexpr' does not name a type
  295 | template<class C> constexpr auto rend(C& c) -> decltype(c.rend());
      |                   ^~~~~~~~~
p967.cpp:295:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:296:19: error: 'constexpr' does not name a type
  296 | template<class C> constexpr auto rend(const C& c) -> decltype(c.rend());
      |                   ^~~~~~~~~
p967.cpp:296:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:297:29: error: 'constexpr' does not name a type
  297 | template<class T, size_t N> constexpr reverse_iterator<T*> rbegin(T (&array)[N]);
      |                             ^~~~~~~~~
p967.cpp:297:29: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:298:29: error: 'constexpr' does not name a type
  298 | template<class T, size_t N> constexpr reverse_iterator<T*> rend(T (&array)[N]);
      |                             ^~~~~~~~~
p967.cpp:298:29: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:299:19: error: 'constexpr' does not name a type
  299 | template<class E> constexpr reverse_iterator<const E*> rbegin(initializer_list<E> il);
      |                   ^~~~~~~~~
p967.cpp:299:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:300:19: error: 'constexpr' does not name a type
  300 | template<class E> constexpr reverse_iterator<const E*> rend(initializer_list<E> il);
      |                   ^~~~~~~~~
p967.cpp:300:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:301:19: error: 'constexpr' does not name a type
  301 | template<class C> constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c));
      |                   ^~~~~~~~~
p967.cpp:301:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:302:19: error: 'constexpr' does not name a type
  302 | template<class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));
      |                   ^~~~~~~~~
p967.cpp:302:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:303:19: error: 'constexpr' does not name a type
  303 | template<class C> constexpr auto size(const C& c) -> decltype(c.size());
      |                   ^~~~~~~~~
p967.cpp:303:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:304:29: error: 'constexpr' does not name a type
  304 | template<class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept;
      |                             ^~~~~~~~~
p967.cpp:304:29: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:305:19: error: 'constexpr' does not name a type
  305 | template<class C> constexpr auto ssize(const C& c)
      |                   ^~~~~~~~~
p967.cpp:305:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:307:32: error: 'constexpr' does not name a type
  307 | template<class T, ptrdiff_t N> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept;
      |                                ^~~~~~~~~
p967.cpp:307:32: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:308:19: error: expected unqualified-id before '[' token
  308 | template<class C> [[nodiscard]] constexpr auto empty(const C& c) -> decltype(c.empty());
      |                   ^
p967.cpp:309:29: error: expected unqualified-id before '[' token
  309 | template<class T, size_t N> [[nodiscard]] constexpr bool empty(const T (&array)[N]) noexcept;
      |                             ^
p967.cpp:310:19: error: expected unqualified-id before '[' token
  310 | template<class E> [[nodiscard]] constexpr bool empty(initializer_list<E> il) noexcept;
      |                   ^
p967.cpp:311:19: error: 'constexpr' does not name a type
  311 | template<class C> constexpr auto data(C& c) -> decltype(c.data());
      |                   ^~~~~~~~~
p967.cpp:311:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:312:19: error: 'constexpr' does not name a type
  312 | template<class C> constexpr auto data(const C& c) -> decltype(c.data());
      |                   ^~~~~~~~~
p967.cpp:312:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:313:29: error: 'constexpr' does not name a type
  313 | template<class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;
      |                             ^~~~~~~~~
p967.cpp:313:29: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:314:26: error: 'constexpr' does not name a type
  314 |        template<class E> constexpr const E* data(initializer_list<E> il) noexcept;
      |                          ^~~~~~~~~
p967.cpp:314:26: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p967.cpp:315:6: error: expected declaration before '}' token
  315 |      }
      |      ^

$ g++ p967.cpp -std=2b -o p967g -I. -Wall
p967.cpp:19:12: error: declaration of template parameter 'T' shadows template parameter
   19 |   template<class T>
      |            ^~~~~
p967.cpp:18:12: note: template parameter 'T' declared here
   18 |   template<class T>
      |            ^~~~~
p967.cpp:21:11: error: expected '=' before '-' token
   21 | using with-reference = T&; // exposition only
      |           ^
p967.cpp:21:11: error: expected type-specifier before '-' token
p967.cpp:22:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   22 | concept can-reference // exposition only = requires { typename with-reference<T>; };
      | ^~~~~~~
p967.cpp:22:9: error: 'can' does not name a type
   22 | concept can-reference // exposition only = requires { typename with-reference<T>; };
      |         ^~~
p967.cpp:24:8: error: expected unqualified-id before '->' token
   24 | { *t } -> can-reference ; // not required to be equality-preserving };
      |        ^~
p967.cpp:28:27: error: 'see_below' does not name a type
   28 | using iter_difference_t = see_below;
      |                           ^~~~~~~~~
p967.cpp:31:22: error: 'see_below' does not name a type
   31 | using iter_value_t = see_below;
      |                      ^~~~~~~~~
p967.cpp:35:10: error: 'dereferenceable' has not been declared
   35 | template<dereferenceable T>
      |          ^~~~~~~~~~~~~~~
p967.cpp:36:44: error: 'T' was not declared in this scope
   36 | using iter_reference_t = decltype(*declval<T&>());
      |                                            ^
p967.cpp:36:36: error: parse error in template argument list
   36 | using iter_reference_t = decltype(*declval<T&>());
      |                                    ^~~~~~~~~~~
p967.cpp:36:7: error: conflicting declaration of template 'template<<declaration error> > using iter_reference_t = decltype (* declval<<expression error> >())'
   36 | using iter_reference_t = decltype(*declval<T&>());
      |       ^~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/bits/stl_iterator_base_types.h:71,
                 from /usr/local/include/c++/12.1.0/bits/stl_construct.h:61,
                 from /usr/local/include/c++/12.1.0/bits/char_traits.h:46,
                 from /usr/local/include/c++/12.1.0/ios:40,
                 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 p967.cpp:10:
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:76:11: note: previous declaration 'template<class _Tp>  requires  __dereferenceable<_Tp> using iter_reference_t = decltype (* declval<_Tp&>())'
   76 |     using iter_reference_t = decltype(*std::declval<_Tp&>());
      |           ^~~~~~~~~~~~~~~~
p967.cpp:40:1: error: 'iter_move' does not name a type
   40 | iter_move =
      | ^~~~~~~~~
p967.cpp:43:10: error: 'dereferenceable' has not been declared
   43 | template<dereferenceable T> requires requires(T& t) {
      |          ^~~~~~~~~~~~~~~
p967.cpp:43:47: error: 'T' has not been declared
   43 | template<dereferenceable T> requires requires(T& t) {
      |                                               ^
p967.cpp:45:3: error: 'unspecified' was not declared in this scope
   45 | = unspecified ;
      |   ^~~~~~~~~~~
p967.cpp:46:3: error: expected unqualified-id before '}' token
   46 | } }
      |   ^
p967.cpp:47:1: error: expected unqualified-id before '{' token
   47 | { ranges::iter_move(t) } -> cans_reference; }
      | ^
p967.cpp:47:26: error: expected unqualified-id before '->' token
   47 | { ranges::iter_move(t) } -> cans_reference; }
      |                          ^~
p967.cpp:49:40: error: 'T' was not declared in this scope
   49 |   = decltype(ranges::iter_move(declval<T&>()));
      |                                        ^
p967.cpp:49:32: error: parse error in template argument list
   49 |   = decltype(ranges::iter_move(declval<T&>()));
      |                                ^~~~~~~~~~~
p967.cpp:49:43: error: no matching function for call to 'declval<<expression error> >()'
   49 |   = decltype(ranges::iter_move(declval<T&>()));
      |                                ~~~~~~~~~~~^~
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:2393:10: note: candidate: 'template<class _Tp> decltype (__declval<_Tp>(0)) std::declval()'
 2393 |     auto declval() noexcept -> decltype(__declval<_Tp>(0))
      |          ^~~~~~~
/usr/local/include/c++/12.1.0/type_traits:2393:10: note:   template argument deduction/substitution failed:
p967.cpp:49:43: error: template argument 1 is invalid
   49 |   = decltype(ranges::iter_move(declval<T&>()));
      |                                ~~~~~~~~~~~^~
p967.cpp:49:43: error: no matching function for call to 'declval<<expression error> >()'
/usr/local/include/c++/12.1.0/type_traits:2393:10: note: candidate: 'template<class _Tp> decltype (__declval<_Tp>(0)) std::declval()'
 2393 |     auto declval() noexcept -> decltype(__declval<_Tp>(0))
      |          ^~~~~~~
/usr/local/include/c++/12.1.0/type_traits:2393:10: note:   template argument deduction/substitution failed:
p967.cpp:49:43: error: template argument 1 is invalid
   49 |   = decltype(ranges::iter_move(declval<T&>()));
      |                                ~~~~~~~~~~~^~
p967.cpp:52:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   52 | concept indirectly_readable = see_below;
      | ^~~~~~~
p967.cpp:52:9: error: expected 'auto' or 'decltype(auto)' after 'indirectly_readable'
   52 | concept indirectly_readable = see_below;
      |         ^~~~~~~~~~~~~~~~~~~
p967.cpp:52:29: error: expected unqualified-id before '=' token
   52 | concept indirectly_readable = see_below;
      |                             ^
p967.cpp:57:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   57 | concept indirectly_writable = see_below;
      | ^~~~~~~
p967.cpp:57:9: error: wrong number of template arguments (1, should be 2)
   57 | concept indirectly_writable = see_below;
      |         ^~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:542:13: note: provided for 'template<class _Out, class _Tp> concept std::indirectly_writable'
  542 |     concept indirectly_writable = requires(_Out&& __o, _Tp&& __t)
      |             ^~~~~~~~~~~~~~~~~~~
p967.cpp:57:29: error: expected unqualified-id before '=' token
   57 | concept indirectly_writable = see_below;
      |                             ^
p967.cpp:59:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   59 | concept weakly_incrementable = see_below;
      | ^~~~~~~
p967.cpp:59:9: error: expected 'auto' or 'decltype(auto)' after 'weakly_incrementable'
   59 | concept weakly_incrementable = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~
p967.cpp:59:30: error: expected unqualified-id before '=' token
   59 | concept weakly_incrementable = see_below;
      |                              ^
p967.cpp:61:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   61 | concept incrementable = see_below;
      | ^~~~~~~
p967.cpp:61:9: error: expected 'auto' or 'decltype(auto)' after 'incrementable'
   61 | concept incrementable = see_below;
      |         ^~~~~~~~~~~~~
p967.cpp:61:23: error: expected unqualified-id before '=' token
   61 | concept incrementable = see_below;
      |                       ^
p967.cpp:63:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   63 | concept input_or_output_iterator = see_below;
      | ^~~~~~~
p967.cpp:63:9: error: expected 'auto' or 'decltype(auto)' after 'input_or_output_iterator'
   63 | concept input_or_output_iterator = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:63:34: error: expected unqualified-id before '=' token
   63 | concept input_or_output_iterator = see_below;
      |                                  ^
p967.cpp:65:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   65 | concept sentinel_for = see_below;
      | ^~~~~~~
p967.cpp:65:9: error: wrong number of template arguments (1, should be 2)
   65 | concept sentinel_for = see_below;
      |         ^~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:619:13: note: provided for 'template<class _Sent, class _Iter> concept std::sentinel_for'
  619 |     concept sentinel_for = semiregular<_Sent>
      |             ^~~~~~~~~~~~
p967.cpp:65:22: error: expected unqualified-id before '=' token
   65 | concept sentinel_for = see_below;
      |                      ^
p967.cpp:69:30: error: 'see_below' was not declared in this scope
   69 | concept sized_sentinel_for = see_below;
      |                              ^~~~~~~~~
p967.cpp:71:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   71 | concept input_iterator = see_below;
      | ^~~~~~~
p967.cpp:71:9: error: expected 'auto' or 'decltype(auto)' after 'input_iterator'
   71 | concept input_iterator = see_below;
      |         ^~~~~~~~~~~~~~
p967.cpp:71:24: error: expected unqualified-id before '=' token
   71 | concept input_iterator = see_below;
      |                        ^
p967.cpp:73:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   73 | concept output_iterator = see_below;
      | ^~~~~~~
p967.cpp:73:9: error: wrong number of template arguments (1, should be 2)
   73 | concept output_iterator = see_below;
      |         ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:642:13: note: provided for 'template<class _Iter, class _Tp> concept std::output_iterator'
  642 |     concept output_iterator = input_or_output_iterator<_Iter>
      |             ^~~~~~~~~~~~~~~
p967.cpp:73:25: error: expected unqualified-id before '=' token
   73 | concept output_iterator = see_below;
      |                         ^
p967.cpp:75:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   75 | concept forward_iterator = see_below;
      | ^~~~~~~
p967.cpp:75:9: error: expected 'auto' or 'decltype(auto)' after 'forward_iterator'
   75 | concept forward_iterator = see_below;
      |         ^~~~~~~~~~~~~~~~
p967.cpp:75:26: error: expected unqualified-id before '=' token
   75 | concept forward_iterator = see_below;
      |                          ^
p967.cpp:77:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   77 | concept bidirectional_iterator = see_below;
      | ^~~~~~~
p967.cpp:77:9: error: expected 'auto' or 'decltype(auto)' after 'bidirectional_iterator'
   77 | concept bidirectional_iterator = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~~~
p967.cpp:77:32: error: expected unqualified-id before '=' token
   77 | concept bidirectional_iterator = see_below;
      |                                ^
p967.cpp:79:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   79 | concept random_access_iterator = see_below;
      | ^~~~~~~
p967.cpp:79:9: error: expected 'auto' or 'decltype(auto)' after 'random_access_iterator'
   79 | concept random_access_iterator = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~~~
p967.cpp:79:32: error: expected unqualified-id before '=' token
   79 | concept random_access_iterator = see_below;
      |                                ^
p967.cpp:81:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   81 | concept contiguous_iterator = see_below;
      | ^~~~~~~
p967.cpp:81:9: error: expected 'auto' or 'decltype(auto)' after 'contiguous_iterator'
   81 | concept contiguous_iterator = see_below;
      |         ^~~~~~~~~~~~~~~~~~~
p967.cpp:81:29: error: expected unqualified-id before '=' token
   81 | concept contiguous_iterator = see_below;
      |                             ^
p967.cpp:83:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   83 | concept indirectly_unary_invocable = see_below; template<class F, class I>
      | ^~~~~~~
p967.cpp:83:9: error: wrong number of template arguments (1, should be 2)
   83 | concept indirectly_unary_invocable = see_below; template<class F, class I>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:693:13: note: provided for 'template<class _Fn, class _Iter> concept std::indirectly_unary_invocable'
  693 |     concept indirectly_unary_invocable = indirectly_readable<_Iter>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:83:36: error: expected unqualified-id before '=' token
   83 | concept indirectly_unary_invocable = see_below; template<class F, class I>
      |                                    ^
p967.cpp:84:46: error: 'see_below' was not declared in this scope
   84 | concept indirectly_regular_unary_invocable = see_below; template<class F, class I>
      |                                              ^~~~~~~~~
p967.cpp:85:36: error: 'see_below' was not declared in this scope
   85 | concept indirect_unary_predicate = see_below; template<class F, class I1, class I2>
      |                                    ^~~~~~~~~
p967.cpp:86:37: error: 'see_below' was not declared in this scope
   86 | concept indirect_binary_predicate = see_below; template<class F, class I1, class I2 = I1>
      |                                     ^~~~~~~~~
p967.cpp:87:41: error: 'see_below' was not declared in this scope
   87 | concept indirect_equivalence_relation = see_below; template<class F, class I1, class I2 = I1>
      |                                         ^~~~~~~~~
p967.cpp:88:38: error: 'see_below' was not declared in this scope
   88 | concept indirect_strict_weak_order = see_below;
      |                                      ^~~~~~~~~
p967.cpp:98:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   98 | concept indirectly_movable = see_below; template<class In, class Out>
      | ^~~~~~~
p967.cpp:98:9: error: wrong number of template arguments (1, should be 2)
   98 | concept indirectly_movable = see_below; template<class In, class Out>
      |         ^~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:773:13: note: provided for 'template<class _In, class _Out> concept std::indirectly_movable'
  773 |     concept indirectly_movable = indirectly_readable<_In>
      |             ^~~~~~~~~~~~~~~~~~
p967.cpp:98:28: error: expected unqualified-id before '=' token
   98 | concept indirectly_movable = see_below; template<class In, class Out>
      |                            ^
p967.cpp:99:39: error: 'see_below' was not declared in this scope
   99 | concept indirectly_movable_storable = see_below;
      |                                       ^~~~~~~~~
p967.cpp:101:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
  101 | concept indirectly_copyable = see_below; template<class In, class Out>
      | ^~~~~~~
p967.cpp:101:9: error: wrong number of template arguments (1, should be 2)
  101 | concept indirectly_copyable = see_below; template<class In, class Out>
      |         ^~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:785:13: note: provided for 'template<class _In, class _Out> concept std::indirectly_copyable'
  785 |     concept indirectly_copyable = indirectly_readable<_In>
      |             ^~~~~~~~~~~~~~~~~~~
p967.cpp:101:29: error: expected unqualified-id before '=' token
  101 | concept indirectly_copyable = see_below; template<class In, class Out>
      |                             ^
p967.cpp:102:40: error: 'see_below' was not declared in this scope
  102 | concept indirectly_copyable_storable = see_below;
      |                                        ^~~~~~~~~
p967.cpp:104:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
  104 | concept indirectly_swappable = see_below;
      | ^~~~~~~
p967.cpp:104:9: error: expected 'auto' or 'decltype(auto)' after 'indirectly_swappable'
  104 | concept indirectly_swappable = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~
p967.cpp:104:30: error: expected unqualified-id before '=' token
  104 | concept indirectly_swappable = see_below;
      |                              ^
p967.cpp:107:33: error: 'see_below' was not declared in this scope
  107 | concept indirectly_comparable = see_below;
      |                                 ^~~~~~~~~
p967.cpp:109:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
  109 | concept permutable = see_below;
      | ^~~~~~~
p967.cpp:109:9: error: expected 'auto' or 'decltype(auto)' after 'permutable'
  109 | concept permutable = see_below;
      |         ^~~~~~~~~~
p967.cpp:109:20: error: expected unqualified-id before '=' token
  109 | concept permutable = see_below;
      |                    ^
p967.cpp:111:9: error: expected unqualified-id before '=' token
  111 | class R = ranges::less, class P1 = identity, class P2 = identity> concept mergeable = see_below;
      |         ^
p967.cpp:114:20: error: 'see_below' was not declared in this scope
  114 | concept sortable = see_below;
      |                    ^~~~~~~~~
p967.cpp:130:5: error: redeclaration of 'template<class InputIterator> constexpr InputIterator std::next(InputIterator, typename iterator_traits<_Iter>::difference_type)' may not have default arguments [-fpermissive]
  130 |     next(InputIterator x,
      |     ^~~~
p967.cpp:134:5: error: redeclaration of 'template<class BidirectionalIterator> constexpr BidirectionalIterator std::prev(BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' may not have default arguments [-fpermissive]
  134 |     prev(BidirectionalIterator x,
      |     ^~~~
p967.cpp:138:20: error: variable or field 'advance' declared void
  138 |     constexpr void advance(I& i, iter_difference_t<I> n);
      |                    ^~~~~~~
p967.cpp:138:28: error: 'I' was not declared in this scope
  138 |     constexpr void advance(I& i, iter_difference_t<I> n);
      |                            ^
p967.cpp:138:31: error: 'i' was not declared in this scope
  138 |     constexpr void advance(I& i, iter_difference_t<I> n);
      |                               ^
p967.cpp:138:52: error: 'I' was not declared in this scope
  138 |     constexpr void advance(I& i, iter_difference_t<I> n);
      |                                                    ^
p967.cpp:138:53: error: template argument 1 is invalid
  138 |     constexpr void advance(I& i, iter_difference_t<I> n);
      |                                                     ^
p967.cpp:144:5: error: expected unqualified-id before 'requires'
  144 |     requires (!sized_sentinel_for<S, I>)
      |     ^~~~~~~~
p967.cpp:148:12: error: 'range' has not been declared
  148 |   template<range R>
      |            ^~~~~
p967.cpp:149:15: error: 'range_difference_t' does not name a type
  149 |     constexpr range_difference_t<R> distance(R&& r);
      |               ^~~~~~~~~~~~~~~~~~
p967.cpp:151:15: error: 'I' does not name a type
  151 |     constexpr I next(I x);
      |               ^
p967.cpp:159:15: error: 'I' does not name a type
  159 |     constexpr I prev(I x);
      |               ^
p967.cpp:164:1: error: expected declaration before '}' token
  164 | }
      | ^
p967.cpp:208:25: error: redefinition of 'constexpr const bool std::disable_sized_sentinel_for<std::reverse_iterator<_IteratorL>, std::reverse_iterator<_IteratorR> >'
  208 |   inline constexpr bool disable_sized_sentinel_for<reverse_iterator<Iterator1>,reverse_iterator<Iterator2>> = true;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/string:47,
                 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:
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:657:5: note: 'constexpr const bool std::disable_sized_sentinel_for<std::reverse_iterator<_IteratorL>, std::reverse_iterator<_IteratorR> >' previously declared here
  657 |     disable_sized_sentinel_for<reverse_iterator<_Iterator1>,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  658 |                                reverse_iterator<_Iterator2>> = true;
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p967.cpp:251:3: error: expected unqualified-id before 'requires'
  251 |   requires (!same_as<I, S> && copyable<I>)
      |   ^~~~~~~~
p967.cpp:264:8: error: 'std::iterator_traits<std::counted_iterator<_It> >' does not match original declaration
  264 | struct iterator_traits<counted_iterator<I>>;
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:52:12: note: original template declaration here
   52 |     struct iterator_traits;
      |            ^~~~~~~~~~~~~~~
p967.cpp:315:6: error: expected declaration before '}' token
  315 |      }
      |      ^

```

## 検討事項(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 初稿 　20220808