0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

18.3 Header <concepts> synopsis [concepts.syn] C++N4910:2022 (351) p546.c

Last updated at Posted at 2022-07-12

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

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++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

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

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の2種類
でコンパイルし、

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

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

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

C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list

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++

編纂器(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.

18.3 Header synopsis [concepts.syn] C++N4910:2022 (351) p546.c

算譜(source code)

p546.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 = "18.3 Header <concepts> synopsis [concepts.syn] C++N4910:2022 (351) p546.c";
// 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 <typeinfo>

using namespace std;

#define see_below int
// Example 1
namespace std {
// 18.4, language-related concepts
// 18.4.2, concept same_as
template<class T, class U>
concept same_as = see_below;
// 18.4.3, concept derived_from
template<class Derived, class Base>
concept derived_from = see_below;
// 18.4.4, concept convertible_to
template<class From, class To>
concept convertible_to = see_below;
// 18.4.5, concept common_reference_with
template<class T, class U>
concept common_reference_with = see_below;
// 18.4.6, concept common_with
template<class T, class U>
concept common_with = see_below;
// 18.4.7, arithmetic concepts
template<class T>
concept integral = see_below;
template<class T>
concept signed_integral = see_below;
template<class T>
concept unsigned_integral = see_below;
template<class T>
concept floating_point = see_below;
// 18.4.8, concept assignable_from
template<class LHS, class RHS>
concept assignable_from = see_below;
// 18.4.9, concept swappable
namespace ranges {
inline namespace unspecified {
inline constexpr unspecified swap =
}
}
template<class T>
concept swappable = see_below;
template<class T, class U>
concept swappable_with = see_below;
// 18.4.10, concept destructible
template<class T>
concept destructible = see_below;
// 18.4.11, concept constructible_from
template<class T, class... Args>
unspecified ;
concept constructible_from = see below;
// 18.4.12, concept default_initializable
template<class T>
concept default_initializable = see below;
// 18.4.13, concept move_constructible
template<class T>
concept move_constructible = see below;
// 18.4.14, concept copy_constructible
template<class T>
concept copy_constructible = see below;
// 18.5, comparison concepts
// 18.5.3, concept equality_comparable
template<class T>
concept equality_comparable = see below;
template<class T, class U>
concept equality_comparable_with = see_below;
// 18.5.4, concept totally_ordered
template<class T>
concept totally_ordered = see_below;
template<class T, class U>
concept totally_ordered_with = see_below;
// 18.6, object concepts
template<class T>
concept movable = see_below;
template<class T>
concept copyable = see_below;
template<class T>
concept semiregular = see_below;
template<class T>
concept regular = see_below;
// 18.7, callable concepts
// 18.7.2, concept invocable
template<class F, class... Args>
concept invocable = see_below;
// 18.7.3, concept regular_invocable
template<class F, class... Args>
concept regular_invocable = see_below;
// 18.7.4, concept predicate
template<class F, class... Args>
concept predicate = see_below;
// 18.7.5, concept relation
template<class R, class T, class U>
concept relation = see_below;
// 18.7.6, concept equivalence_relation
template<class R, class T, class U>
concept equivalence_relation = see_below;
// 18.7.7, concept strict_weak_order
template<class R, class T, class U>
concept strict_weak_order = see_below;
}
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

Script

clgc.sh
#!/bin/sh
rm $1l
rm $1g
echo "$ clang++ $1.cpp -std=03 -o $1l -I. -Wall" 
clang++ $1.cpp -std=c++03 -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l 
fi
rm $1l
echo "$ clang++ $1.cpp -std=2b -o $1l -I. -Wall"
clang++ $1.cpp -std=c++2b -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l
fi
echo "\r"
echo "$ g++ $1.cpp -std=03 -o $1g -I. -Wall"
g++ $1.cpp -std=c++03 -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g
fi
rm $1g
echo "\r"
echo "$ g++ $1.cpp -std=2b -o $1g -I. -Wall"
g++ $1.cpp -std=c++2b -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g 
fi

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

bash
# ./clgc.sh p546
$ clang++ p546.cpp -std=c++03 -o p546l -I. -Wall
In file included from p546.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 \
 ^
p546.cpp:31:1: error: unknown type name 'concept'
concept same_as = see_below;
^
p546.cpp:31:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept same_as = see_below;
        ^
p546.cpp:31:28: error: expected '(' for function-style cast or type construction
concept same_as = see_below;
                  ~~~~~~~~~^
p546.cpp:34:1: error: unknown type name 'concept'
concept derived_from = see_below;
^
p546.cpp:34:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept derived_from = see_below;
        ^
p546.cpp:34:33: error: expected '(' for function-style cast or type construction
concept derived_from = see_below;
                       ~~~~~~~~~^
p546.cpp:37:1: error: unknown type name 'concept'
concept convertible_to = see_below;
^
p546.cpp:37:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept convertible_to = see_below;
        ^
p546.cpp:37:35: error: expected '(' for function-style cast or type construction
concept convertible_to = see_below;
                         ~~~~~~~~~^
p546.cpp:40:1: error: unknown type name 'concept'
concept common_reference_with = see_below;
^
p546.cpp:40:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept common_reference_with = see_below;
        ^
p546.cpp:40:42: error: expected '(' for function-style cast or type construction
concept common_reference_with = see_below;
                                ~~~~~~~~~^
p546.cpp:43:1: error: unknown type name 'concept'
concept common_with = see_below;
^
p546.cpp:43:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept common_with = see_below;
        ^
p546.cpp:43:32: error: expected '(' for function-style cast or type construction
concept common_with = see_below;
                      ~~~~~~~~~^
p546.cpp:46:1: error: unknown type name 'concept'
concept integral = see_below; 
^
p546.cpp:46:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept integral = see_below; 
        ^
p546.cpp:46:29: error: expected '(' for function-style cast or type construction
concept integral = see_below; 
                   ~~~~~~~~~^
p546.cpp:48:1: error: unknown type name 'concept'
concept signed_integral = see_below; 
^
p546.cpp:48:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept signed_integral = see_below; 
        ^
p546.cpp:48:36: error: expected '(' for function-style cast or type construction
concept signed_integral = see_below; 
                          ~~~~~~~~~^
p546.cpp:50:1: error: unknown type name 'concept'
concept unsigned_integral = see_below; 
^
p546.cpp:50:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept unsigned_integral = see_below; 
        ^
p546.cpp:50:38: error: expected '(' for function-style cast or type construction
concept unsigned_integral = see_below; 
                            ~~~~~~~~~^
p546.cpp:52:1: error: unknown type name 'concept'
concept floating_point = see_below;
^
p546.cpp:52:9: warning: variable templates are a C++14 extension [-Wc++14-extensions]
concept floating_point = see_below;
        ^
p546.cpp:52:35: error: expected '(' for function-style cast or type construction
concept floating_point = see_below;
                         ~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
9 warnings and 20 errors generated.
rm: cannot remove 'p546l': No such file or directory
$ clang++ p546.cpp -std=c++2b -o p546l -I. -Wall
p546.cpp:31:28: error: expected '(' for function-style cast or type construction
concept same_as = see_below;
                  ~~~~~~~~~^
p546.cpp:34:33: error: expected '(' for function-style cast or type construction
concept derived_from = see_below;
                       ~~~~~~~~~^
p546.cpp:37:35: error: expected '(' for function-style cast or type construction
concept convertible_to = see_below;
                         ~~~~~~~~~^
p546.cpp:40:42: error: expected '(' for function-style cast or type construction
concept common_reference_with = see_below;
                                ~~~~~~~~~^
p546.cpp:43:32: error: expected '(' for function-style cast or type construction
concept common_with = see_below;
                      ~~~~~~~~~^
p546.cpp:46:29: error: expected '(' for function-style cast or type construction
concept integral = see_below; 
                   ~~~~~~~~~^
p546.cpp:48:36: error: expected '(' for function-style cast or type construction
concept signed_integral = see_below; 
                          ~~~~~~~~~^
p546.cpp:50:38: error: expected '(' for function-style cast or type construction
concept unsigned_integral = see_below; 
                            ~~~~~~~~~^
p546.cpp:52:35: error: expected '(' for function-style cast or type construction
concept floating_point = see_below;
                         ~~~~~~~~~^
p546.cpp:55:36: error: expected '(' for function-style cast or type construction
concept assignable_from = see_below;
                          ~~~~~~~~~^
p546.cpp:59:18: error: unknown type name 'unspecified'
inline constexpr unspecified swap =
                 ^
p546.cpp:60:1: error: expected expression
} }
^
p546.cpp:60:2: error: expected ';' after top level declarator
} }
 ^
 ;
p546.cpp:62:30: error: expected '(' for function-style cast or type construction
concept swappable = see_below;
                    ~~~~~~~~~^
p546.cpp:64:35: error: expected '(' for function-style cast or type construction
concept swappable_with = see_below;
                         ~~~~~~~~~^
p546.cpp:67:33: error: expected '(' for function-style cast or type construction
concept destructible = see_below;
                       ~~~~~~~~~^
p546.cpp:70:1: error: C++ requires a type specifier for all declarations
unspecified ;
^
p546.cpp:71:1: error: expected unqualified-id
concept constructible_from = see below;
^
p546.cpp:74:33: error: use of undeclared identifier 'see'
concept default_initializable = see below;
                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p546.cpp -std=c++03 -o p546g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from p546.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 \
      |  ^~~~~
p546.cpp:59:8: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   59 | inline constexpr unspecified swap =
      |        ^~~~~~~~~
p546.cpp:31:1: error: 'concept' does not name a type
   31 | concept same_as = see_below;
      | ^~~~~~~
p546.cpp:31:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:34:1: error: 'concept' does not name a type
   34 | concept derived_from = see_below;
      | ^~~~~~~
p546.cpp:34:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:37:1: error: 'concept' does not name a type
   37 | concept convertible_to = see_below;
      | ^~~~~~~
p546.cpp:37:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:40:1: error: 'concept' does not name a type
   40 | concept common_reference_with = see_below;
      | ^~~~~~~
p546.cpp:40:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:43:1: error: 'concept' does not name a type
   43 | concept common_with = see_below;
      | ^~~~~~~
p546.cpp:43:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:46:1: error: 'concept' does not name a type
   46 | concept integral = see_below;
      | ^~~~~~~
p546.cpp:46:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:48:1: error: 'concept' does not name a type
   48 | concept signed_integral = see_below;
      | ^~~~~~~
p546.cpp:48:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:50:1: error: 'concept' does not name a type
   50 | concept unsigned_integral = see_below;
      | ^~~~~~~
p546.cpp:50:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:52:1: error: 'concept' does not name a type
   52 | concept floating_point = see_below;
      | ^~~~~~~
p546.cpp:52:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:55:1: error: 'concept' does not name a type
   55 | concept assignable_from = see_below;
      | ^~~~~~~
p546.cpp:55:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:59:8: error: 'constexpr' does not name a type
   59 | inline constexpr unspecified swap =
      |        ^~~~~~~~~
p546.cpp:59:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p546.cpp:62:1: error: 'concept' does not name a type
   62 | concept swappable = see_below;
      | ^~~~~~~
p546.cpp:62:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:64:1: error: 'concept' does not name a type
   64 | concept swappable_with = see_below;
      | ^~~~~~~
p546.cpp:64:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:67:1: error: 'concept' does not name a type
   67 | concept destructible = see_below;
      | ^~~~~~~
p546.cpp:67:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:69:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extension]
   69 | template<class T, class... Args>
      |                        ^~~
p546.cpp:70:1: error: 'unspecified' does not name a type
   70 | unspecified ;
      | ^~~~~~~~~~~
p546.cpp:71:1: error: 'concept' does not name a type
   71 | concept constructible_from = see below;
      | ^~~~~~~
p546.cpp:71:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:74:1: error: 'concept' does not name a type
   74 | concept default_initializable = see below;
      | ^~~~~~~
p546.cpp:74:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:77:1: error: 'concept' does not name a type
   77 | concept move_constructible = see below;
      | ^~~~~~~
p546.cpp:77:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:80:1: error: 'concept' does not name a type
   80 | concept copy_constructible = see below;
      | ^~~~~~~
p546.cpp:80:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:84:1: error: 'concept' does not name a type
   84 | concept equality_comparable = see below;
      | ^~~~~~~
p546.cpp:84:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:86:1: error: 'concept' does not name a type
   86 | concept equality_comparable_with = see_below;
      | ^~~~~~~
p546.cpp:86:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:89:1: error: 'concept' does not name a type
   89 | concept totally_ordered = see_below;
      | ^~~~~~~
p546.cpp:89:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:91:1: error: 'concept' does not name a type
   91 | concept totally_ordered_with = see_below;
      | ^~~~~~~
p546.cpp:91:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:94:1: error: 'concept' does not name a type
   94 | concept movable = see_below;
      | ^~~~~~~
p546.cpp:94:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:96:1: error: 'concept' does not name a type
   96 | concept copyable = see_below;
      | ^~~~~~~
p546.cpp:96:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:98:1: error: 'concept' does not name a type
   98 | concept semiregular = see_below;
      | ^~~~~~~
p546.cpp:98:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:100:1: error: 'concept' does not name a type
  100 | concept regular = see_below;
      | ^~~~~~~
p546.cpp:100:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:103:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  103 | template<class F, class... Args>
      |                        ^~~
p546.cpp:104:1: error: 'concept' does not name a type
  104 | concept invocable = see_below;
      | ^~~~~~~
p546.cpp:104:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:106:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  106 | template<class F, class... Args>
      |                        ^~~
p546.cpp:107:1: error: 'concept' does not name a type
  107 | concept regular_invocable = see_below;
      | ^~~~~~~
p546.cpp:107:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:109:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  109 | template<class F, class... Args>
      |                        ^~~
p546.cpp:110:1: error: 'concept' does not name a type
  110 | concept predicate = see_below;
      | ^~~~~~~
p546.cpp:110:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:113:1: error: 'concept' does not name a type
  113 | concept relation = see_below;
      | ^~~~~~~
p546.cpp:113:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:116:1: error: 'concept' does not name a type
  116 | concept equivalence_relation = see_below;
      | ^~~~~~~
p546.cpp:116:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p546.cpp:119:1: error: 'concept' does not name a type
  119 | concept strict_weak_order = see_below;
      | ^~~~~~~
p546.cpp:119:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
rm: cannot remove 'p546g': No such file or directory

$ g++ p546.cpp -std=c++2b -o p546g -I. -Wall
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:31:19: note: in expansion of macro 'see_below'
   31 | concept same_as = see_below;
      |                   ^~~~~~~~~
p546.cpp:31:9: error: redefinition of 'template<class T, class U> concept std::same_as'
   31 | concept same_as = see_below;
      |         ^~~~~~~
In file included from /usr/local/include/c++/12.1.0/compare:39,
                 from /usr/local/include/c++/12.1.0/bits/char_traits.h:45,
                 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 p546.cpp:10:
/usr/local/include/c++/12.1.0/concepts:62:13: note: 'template<class _Tp, class _Up> concept std::same_as' previously declared here
   62 |     concept same_as
      |             ^~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:34:24: note: in expansion of macro 'see_below'
   34 | concept derived_from = see_below;
      |                        ^~~~~~~~~
p546.cpp:34:9: error: redefinition of 'template<class Derived, class Base> concept std::derived_from'
   34 | concept derived_from = see_below;
      |         ^~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:67:13: note: 'template<class _Derived, class _Base> concept std::derived_from' previously declared here
   67 |     concept derived_from = __is_base_of(_Base, _Derived)
      |             ^~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:37:26: note: in expansion of macro 'see_below'
   37 | concept convertible_to = see_below;
      |                          ^~~~~~~~~
p546.cpp:37:9: error: redefinition of 'template<class From, class To> concept std::convertible_to'
   37 | concept convertible_to = see_below;
      |         ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:72:13: note: 'template<class _From, class _To> concept std::convertible_to' previously declared here
   72 |     concept convertible_to = is_convertible_v<_From, _To>
      |             ^~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:40:33: note: in expansion of macro 'see_below'
   40 | concept common_reference_with = see_below;
      |                                 ^~~~~~~~~
p546.cpp:40:9: error: redefinition of 'template<class T, class U> concept std::common_reference_with'
   40 | concept common_reference_with = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:77:13: note: 'template<class _Tp, class _Up> concept std::common_reference_with' previously declared here
   77 |     concept common_reference_with
      |             ^~~~~~~~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:43:23: note: in expansion of macro 'see_below'
   43 | concept common_with = see_below;
      |                       ^~~~~~~~~
p546.cpp:43:9: error: redefinition of 'template<class T, class U> concept std::common_with'
   43 | concept common_with = see_below;
      |         ^~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:84:13: note: 'template<class _Tp, class _Up> concept std::common_with' previously declared here
   84 |     concept common_with
      |             ^~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:46:20: note: in expansion of macro 'see_below'
   46 | concept integral = see_below;
      |                    ^~~~~~~~~
p546.cpp:46:9: error: redefinition of 'template<class T> concept std::integral'
   46 | concept integral = see_below;
      |         ^~~~~~~~
/usr/local/include/c++/12.1.0/concepts:100:13: note: 'template<class _Tp> concept std::integral' previously declared here
  100 |     concept integral = is_integral_v<_Tp>;
      |             ^~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:48:27: note: in expansion of macro 'see_below'
   48 | concept signed_integral = see_below;
      |                           ^~~~~~~~~
p546.cpp:48:9: error: redefinition of 'template<class T> concept std::signed_integral'
   48 | concept signed_integral = see_below;
      |         ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:103:13: note: 'template<class _Tp> concept std::signed_integral' previously declared here
  103 |     concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
      |             ^~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:50:29: note: in expansion of macro 'see_below'
   50 | concept unsigned_integral = see_below;
      |                             ^~~~~~~~~
p546.cpp:50:9: error: redefinition of 'template<class T> concept std::unsigned_integral'
   50 | concept unsigned_integral = see_below;
      |         ^~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:106:13: note: 'template<class _Tp> concept std::unsigned_integral' previously declared here
  106 |     concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
      |             ^~~~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:52:26: note: in expansion of macro 'see_below'
   52 | concept floating_point = see_below;
      |                          ^~~~~~~~~
p546.cpp:52:9: error: redefinition of 'template<class T> concept std::floating_point'
   52 | concept floating_point = see_below;
      |         ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:109:13: note: 'template<class _Tp> concept std::floating_point' previously declared here
  109 |     concept floating_point = is_floating_point_v<_Tp>;
      |             ^~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:55:27: note: in expansion of macro 'see_below'
   55 | concept assignable_from = see_below;
      |                           ^~~~~~~~~
p546.cpp:55:9: error: redefinition of 'template<class LHS, class RHS> concept std::assignable_from'
   55 | concept assignable_from = see_below;
      |         ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:123:13: note: 'template<class _Lhs, class _Rhs> concept std::assignable_from' previously declared here
  123 |     concept assignable_from
      |             ^~~~~~~~~~~~~~~
p546.cpp:59:18: error: 'unspecified' does not name a type
   59 | inline constexpr unspecified swap =
      |                  ^~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:62:21: note: in expansion of macro 'see_below'
   62 | concept swappable = see_below;
      |                     ^~~~~~~~~
p546.cpp:62:9: error: redefinition of 'template<class T> concept std::swappable'
   62 | concept swappable = see_below;
      |         ^~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:232:13: note: 'template<class _Tp> concept std::swappable' previously declared here
  232 |     concept swappable
      |             ^~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:64:26: note: in expansion of macro 'see_below'
   64 | concept swappable_with = see_below;
      |                          ^~~~~~~~~
p546.cpp:64:9: error: redefinition of 'template<class T, class U> concept std::swappable_with'
   64 | concept swappable_with = see_below;
      |         ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:236:13: note: 'template<class _Tp, class _Up> concept std::swappable_with' previously declared here
  236 |     concept swappable_with = common_reference_with<_Tp, _Up>
      |             ^~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:67:24: note: in expansion of macro 'see_below'
   67 | concept destructible = see_below;
      |                        ^~~~~~~~~
p546.cpp:67:9: error: redefinition of 'template<class T> concept std::destructible'
   67 | concept destructible = see_below;
      |         ^~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:132:13: note: 'template<class _Tp> concept std::destructible' previously declared here
  132 |     concept destructible = is_nothrow_destructible_v<_Tp>;
      |             ^~~~~~~~~~~~
p546.cpp:70:1: error: 'unspecified' does not name a type
   70 | unspecified ;
      | ^~~~~~~~~~~
p546.cpp:71:1: warning: C++20 concept definition syntax is 'concept <name> = <expr>'
   71 | concept constructible_from = see below;
      | ^~~~~~~
p546.cpp:71:9: error: expected 'auto' or 'decltype(auto)' after 'constructible_from'
   71 | concept constructible_from = see below;
      |         ^~~~~~~~~~~~~~~~~~
p546.cpp:71:28: error: expected unqualified-id before '=' token
   71 | concept constructible_from = see below;
      |                            ^
p546.cpp:74:33: error: 'see' was not declared in this scope
   74 | concept default_initializable = see below;
      |                                 ^~~
p546.cpp:74:9: error: redefinition of 'template<class T> concept std::default_initializable'
   74 | concept default_initializable = see below;
      |         ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:141:13: note: 'template<class _Tp> concept std::default_initializable' previously declared here
  141 |     concept default_initializable = constructible_from<_Tp>
      |             ^~~~~~~~~~~~~~~~~~~~~
p546.cpp:77:30: error: 'see' was not declared in this scope
   77 | concept move_constructible = see below;
      |                              ^~~
p546.cpp:77:9: error: redefinition of 'template<class T> concept std::move_constructible'
   77 | concept move_constructible = see below;
      |         ^~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:150:13: note: 'template<class _Tp> concept std::move_constructible' previously declared here
  150 |     concept move_constructible
      |             ^~~~~~~~~~~~~~~~~~
p546.cpp:80:30: error: 'see' was not declared in this scope
   80 | concept copy_constructible = see below;
      |                              ^~~
p546.cpp:80:9: error: redefinition of 'template<class T> concept std::copy_constructible'
   80 | concept copy_constructible = see below;
      |         ^~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:155:13: note: 'template<class _Tp> concept std::copy_constructible' previously declared here
  155 |     concept copy_constructible
      |             ^~~~~~~~~~~~~~~~~~
p546.cpp:84:31: error: 'see' was not declared in this scope
   84 | concept equality_comparable = see below;
      |                               ^~~
p546.cpp:84:9: error: redefinition of 'template<class T> concept std::equality_comparable'
   84 | concept equality_comparable = see below;
      |         ^~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:288:13: note: 'template<class _Tp> concept std::equality_comparable' previously declared here
  288 |     concept equality_comparable = __detail::__weakly_eq_cmp_with<_Tp, _Tp>;
      |             ^~~~~~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:86:36: note: in expansion of macro 'see_below'
   86 | concept equality_comparable_with = see_below;
      |                                    ^~~~~~~~~
p546.cpp:86:9: error: redefinition of 'template<class T, class U> concept std::equality_comparable_with'
   86 | concept equality_comparable_with = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:291:13: note: 'template<class _Tp, class _Up> concept std::equality_comparable_with' previously declared here
  291 |     concept equality_comparable_with
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:89:27: note: in expansion of macro 'see_below'
   89 | concept totally_ordered = see_below;
      |                           ^~~~~~~~~
p546.cpp:89:9: error: redefinition of 'template<class T> concept std::totally_ordered'
   89 | concept totally_ordered = see_below;
      |         ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:317:13: note: 'template<class _Tp> concept std::totally_ordered' previously declared here
  317 |     concept totally_ordered
      |             ^~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:91:32: note: in expansion of macro 'see_below'
   91 | concept totally_ordered_with = see_below;
      |                                ^~~~~~~~~
p546.cpp:91:9: error: redefinition of 'template<class T, class U> concept std::totally_ordered_with'
   91 | concept totally_ordered_with = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:322:13: note: 'template<class _Tp, class _Up> concept std::totally_ordered_with' previously declared here
  322 |     concept totally_ordered_with
      |             ^~~~~~~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:94:19: note: in expansion of macro 'see_below'
   94 | concept movable = see_below;
      |                   ^~~~~~~~~
p546.cpp:94:9: error: redefinition of 'template<class T> concept std::movable'
   94 | concept movable = see_below;
      |         ^~~~~~~
/usr/local/include/c++/12.1.0/concepts:247:13: note: 'template<class _Tp> concept std::movable' previously declared here
  247 |     concept movable = is_object_v<_Tp> && move_constructible<_Tp>
      |             ^~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:96:20: note: in expansion of macro 'see_below'
   96 | concept copyable = see_below;
      |                    ^~~~~~~~~
p546.cpp:96:9: error: redefinition of 'template<class T> concept std::copyable'
   96 | concept copyable = see_below;
      |         ^~~~~~~~
/usr/local/include/c++/12.1.0/concepts:251:13: note: 'template<class _Tp> concept std::copyable' previously declared here
  251 |     concept copyable = copy_constructible<_Tp> && movable<_Tp>
      |             ^~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:98:23: note: in expansion of macro 'see_below'
   98 | concept semiregular = see_below;
      |                       ^~~~~~~~~
p546.cpp:98:9: error: redefinition of 'template<class T> concept std::semiregular'
   98 | concept semiregular = see_below;
      |         ^~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:256:13: note: 'template<class _Tp> concept std::semiregular' previously declared here
  256 |     concept semiregular = copyable<_Tp> && default_initializable<_Tp>;
      |             ^~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:100:19: note: in expansion of macro 'see_below'
  100 | concept regular = see_below;
      |                   ^~~~~~~~~
p546.cpp:100:9: error: redefinition of 'template<class T> concept std::regular'
  100 | concept regular = see_below;
      |         ^~~~~~~
/usr/local/include/c++/12.1.0/concepts:330:13: note: 'template<class _Tp> concept std::regular' previously declared here
  330 |     concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
      |             ^~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:104:21: note: in expansion of macro 'see_below'
  104 | concept invocable = see_below;
      |                     ^~~~~~~~~
p546.cpp:104:9: error: redefinition of 'template<class F, class ... Args> concept std::invocable'
  104 | concept invocable = see_below;
      |         ^~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:336:13: note: 'template<class _Fn, class ... _Args> concept std::invocable' previously declared here
  336 |     concept invocable = is_invocable_v<_Fn, _Args...>;
      |             ^~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:107:29: note: in expansion of macro 'see_below'
  107 | concept regular_invocable = see_below;
      |                             ^~~~~~~~~
p546.cpp:107:9: error: redefinition of 'template<class F, class ... Args> concept std::regular_invocable'
  107 | concept regular_invocable = see_below;
      |         ^~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:340:13: note: 'template<class _Fn, class ... _Args> concept std::regular_invocable' previously declared here
  340 |     concept regular_invocable = invocable<_Fn, _Args...>;
      |             ^~~~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:110:21: note: in expansion of macro 'see_below'
  110 | concept predicate = see_below;
      |                     ^~~~~~~~~
p546.cpp:110:9: error: redefinition of 'template<class F, class ... Args> concept std::predicate'
  110 | concept predicate = see_below;
      |         ^~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:344:13: note: 'template<class _Fn, class ... _Args> concept std::predicate' previously declared here
  344 |     concept predicate = regular_invocable<_Fn, _Args...>
      |             ^~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:113:20: note: in expansion of macro 'see_below'
  113 | concept relation = see_below;
      |                    ^~~~~~~~~
p546.cpp:113:9: error: redefinition of 'template<class R, class T, class U> concept std::relation'
  113 | concept relation = see_below;
      |         ^~~~~~~~
/usr/local/include/c++/12.1.0/concepts:349:13: note: 'template<class _Rel, class _Tp, class _Up> concept std::relation' previously declared here
  349 |     concept relation
      |             ^~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:116:32: note: in expansion of macro 'see_below'
  116 | concept equivalence_relation = see_below;
      |                                ^~~~~~~~~
p546.cpp:116:9: error: redefinition of 'template<class R, class T, class U> concept std::equivalence_relation'
  116 | concept equivalence_relation = see_below;
      |         ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:355:13: note: 'template<class _Rel, class _Tp, class _Up> concept std::equivalence_relation' previously declared here
  355 |     concept equivalence_relation = relation<_Rel, _Tp, _Up>;
      |             ^~~~~~~~~~~~~~~~~~~~
p546.cpp:25:19: error: expected primary-expression before 'int'
   25 | #define see_below int
      |                   ^~~
p546.cpp:119:29: note: in expansion of macro 'see_below'
  119 | concept strict_weak_order = see_below;
      |                             ^~~~~~~~~
p546.cpp:119:9: error: redefinition of 'template<class R, class T, class U> concept std::strict_weak_order'
  119 | concept strict_weak_order = see_below;
      |         ^~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/concepts:359:13: note: 'template<class _Rel, class _Tp, class _Up> concept std::strict_weak_order' previously declared here
  359 |     concept strict_weak_order = relation<_Rel, _Tp, _Up>;
      |             ^~~~~~~~~~~~~~~~~

検討事項(agenda)

コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

参考資料(reference)

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

コンパイラの実装状況

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

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

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

自己参照(self reference)

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

DoCAP(ドゥーキャップ)って何ですか?

小川メソッド 覚え(書きかけ)

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

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

dockerにclang

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

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

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

C++ sample list

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

astyle 使ってみた

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
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

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

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

文書履歴(document history)

ver. 0.01 初稿  20220712

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?