はじめに(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つの情報に基づいています。
cpprefjp - C++日本語リファレンス
コンパイラの実装状況
また
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.
23 Strings library [strings] 23.2 Character traits [char.traits] C++N4910:2022 (634) p793.cpp
算譜(source code)
// 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 = "23.2 Character traits [char.traits] C++N4910:2022 (634) p793.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;
// 23.2 Character traits [char.traits]
// 23.2.1 General [char.traits.general]
// Subclause 23.2 defines requirements on classes representing character traits, and defines a class templatechar_traits<charT>, along with five specializations, char_traits<char>, char_traits<char8_t>, char_- traits<char16_t>, char_traits<char32_t>, and char_traits<wchar_t>, that meet those requirements.
// Most classes specified in 23.4, 23.3, and Clause 31 need a set of related types and functions to complete the definition of their semantics. These types and functions are provided as a set of member typedef-names and functions in the template parameter traits used by each such template. Subclause 23.2 defines the semantics of these members
// To specialize those templates to generate a string, string view, or iostream class to handle a particular character container type (3.10) C, that and its related character traits class X are passed as a pair of parameters to the string, string view, or iostream template as parameters charT and traits. If X::char_type is not the same type as C, the program is ill-formed.
//23.2.2 Character traits requirements [char.traits.require]
// In Table 75, X denotes a traits class defining types and functions for the character container type C; c and d denote values of type C; p and q denote values of type const C*; s denotes a value of type C*; n, i and j denote values of type size_t; e and f denote values of type X::int_type; pos denotes a value of type X::pos_type; and r denotes an lvalue of type C. No expression which is part of the character traits requirements specified in this subclause 23.2.2 shall exit via an exception.
// The class template
template<class charT> struct char_traits;
//is provided in the header <string> as a basis for explicit specializations.
//23.2.3 Traits typedefs [char.traits.typedefs]
using int_type = see_below;
//Preconditions: int_type shall be able to represent all of the valid characters converted from the corresponding char_type values, as well as an end-of-file value, eof().211 using state_type = see below;
//Preconditions: state_type meets the Cpp17Destructible (Table 34), Cpp17CopyAssignable (Table 33), Cpp17CopyConstructible (Table 31), and Cpp17DefaultConstructible (Table 29) requirements.
//23.2.4 char_traits specializations [char.traits.specializations]
//23.2.4.1 General [char.traits.specializations.general]
namespace std {
template<> struct char_traits<char>;
template<> struct char_traits<char8_t>;
template<> struct char_traits<char16_t>;
template<> struct char_traits<char32_t>;
template<> struct char_traits<wchar_t>;
}
// The header <string> defines five specializations of the class template char_traits: char_traits<char>, char_traits<char8_t>, char_traits<char16_t>, char_traits<char32_t>, and char_traits<wchar_t>.
//23.2.4.2 struct char_traits<char> [char.traits.specializations.char]
namespace std {
template<> struct char_traits<char> {
using char_type = char;
using int_type = int;
using off_type = streamoff;
using pos_type = streampos;
using state_type = mbstate_t;
using comparison_category = strong_ordering;
static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
static constexpr bool eq(char_type c1, char_type c2) noexcept;
static constexpr bool lt(char_type c1, char_type c2) noexcept;
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
static constexpr size_t length(const char_type* s);
static constexpr const char_type* find(const char_type* s, size_t n,
const char_type& a);
static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* assign(char_type* s, size_t n, char_type a);
static constexpr int_type not_eof(int_type c) noexcept;
static constexpr char_type to_char_type(int_type c) noexcept;
static constexpr int_type to_int_type(char_type c) noexcept;
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
static constexpr int_type eof() noexcept;
};
}
// The type mbstate_t is defined in <cwchar> and can represent any of the conversion states that can occur in an implementation-defined set of supported multibyte character encoding rules.
// The two-argument member assign is defined identically to the built-in operator =. The two-argument members eq and lt are defined identically to the built-in operators == and < for type unsigned char.
// The member eof() returns EOF.
// 23.2.4.3 struct char_traits<char8_t> [char.traits.specializations.char8.t]
namespace std {
template<> struct char_traits<char8_t> {
using char_type = char8_t;
using int_type = unsigned int;
using off_type = streamoff;
using pos_type = u8streampos;
using state_type = mbstate_t;
using comparison_category = strong_ordering;
static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
static constexpr bool eq(char_type c1, char_type c2) noexcept;
static constexpr bool lt(char_type c1, char_type c2) noexcept;
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
static constexpr size_t length(const char_type* s);
static constexpr const char_type* find(const char_type* s, size_t n,
const char_type& a);
static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* assign(char_type* s, size_t n, char_type a);
static constexpr int_type not_eof(int_type c) noexcept;
static constexpr char_type to_char_type(int_type c) noexcept;
static constexpr int_type to_int_type(char_type c) noexcept;
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
static constexpr int_type eof() noexcept;
};
}
// The two-argument members assign, eq, and lt are defined identically to the built-in operators =, ==, and < respectively.
// TThe member eof() returns an implementation-defined constant that cannot appear as a valid UTF-8 code unit.
// T23.2.4.4 struct char_traits<char16_t> [char.traits.specializations.char16.t]
namespace std {
template<> struct char_traits<char16_t> {
using char_type = char16_t;
using int_type = uint_least16_t;
using off_type = streamoff;
using pos_type = u16streampos;
using state_type = mbstate_t;
using comparison_category = strong_ordering;
static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
static constexpr bool eq(char_type c1, char_type c2) noexcept;
static constexpr bool lt(char_type c1, char_type c2) noexcept;
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
static constexpr size_t length(const char_type* s);
static constexpr const char_type* find(const char_type* s, size_t n,
const char_type& a);
static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* assign(char_type* s, size_t n, char_type a);
static constexpr int_type not_eof(int_type c) noexcept;
static constexpr char_type to_char_type(int_type c) noexcept;
static constexpr int_type to_int_type(char_type c) noexcept;
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
static constexpr int_type eof() noexcept;
};
}
// The two-argument members assign, eq, and lt are defined identically to the built-in operators =, ==, and <, respectively.
// The member eof() returns an implementation-defined constant that cannot appear as a valid UTF-16 code unit.
// 23.2.4.5 struct char_traits<char32_t> [char.traits.specializations.char32.t]
namespace std {
template<> struct char_traits<char32_t> {
using char_type = char32_t;
using int_type = uint_least32_t;
using off_type = streamoff;
using pos_type = u32streampos;
using state_type = mbstate_t;
using comparison_category = strong_ordering;
static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
static constexpr bool eq(char_type c1, char_type c2) noexcept;
static constexpr bool lt(char_type c1, char_type c2) noexcept;
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
static constexpr size_t length(const char_type* s);
static constexpr const char_type* find(const char_type* s, size_t n,
const char_type& a);
static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* assign(char_type* s, size_t n, char_type a);
static constexpr int_type not_eof(int_type c) noexcept;
static constexpr char_type to_char_type(int_type c) noexcept;
static constexpr int_type to_int_type(char_type c) noexcept;
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
static constexpr int_type eof() noexcept;
};
}
// The two-argument members assign, eq, and lt are defined identically to the built-in operators =, ==, and <, respectively.
// The member eof() returns an implementation-defined constant that cannot appear as a Unicode code point.
// 23.2.4.6 struct char_traits<wchar_t> [char.traits.specializations.wchar.t]
namespace std {
template<> struct char_traits<wchar_t> {
using char_type = wchar_t;
using int_type = wint_t;
using off_type = streamoff;
using state_type = wstreampos;
using comparison_category = strong_ordering;
static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
static constexpr bool eq(char_type c1, char_type c2) noexcept;
static constexpr bool lt(char_type c1, char_type c2) noexcept;
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
static constexpr size_t length(const char_type* s);
static constexpr const char_type* find(const char_type* s, size_t n,
const char_type& a);
static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n);
static constexpr char_type* assign(char_type* s, size_t n, char_type a);
static constexpr int_type not_eof(int_type c) noexcept;
static constexpr char_type to_char_type(int_type c) noexcept;
static constexpr int_type to_int_type(char_type c) noexcept;
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
static constexpr int_type eof() noexcept;
};
}
// The two-argument members assign, eq, and lt are defined identically to the built-in operators =, ==, and <, respectively.
// The member eof() returns WEOF.
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang++ p793.cpp -std=03 -o p793l -I. -Wall
In file included from p793.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 \
^
p793.cpp:25:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using int_type = see_below;
^
p793.cpp:25:18: error: unknown type name 'see_below'
p793.cpp:32:35: error: use of undeclared identifier 'char8_t'; did you mean 'wchar_t'?
template<> struct char_traits<char8_t>;
^~~~~~~
wchar_t
p793.cpp:33:35: error: use of undeclared identifier 'char16_t'
template<> struct char_traits<char16_t>;
^
p793.cpp:34:35: error: use of undeclared identifier 'char32_t'
template<> struct char_traits<char32_t>;
^
p793.cpp:40:23: error: redefinition of 'char_traits<char>'
template<> struct char_traits<char> {
^~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:316:12: note: previous definition is here
struct char_traits<char>
^
p793.cpp:68:38: error: use of undeclared identifier 'char8_t'; did you mean 'wchar_t'?
template<> struct char_traits<char8_t> {
^~~~~~~
wchar_t
p793.cpp:68:26: error: redefinition of 'char_traits<wchar_t>'
template<> struct char_traits<char8_t> {
^~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:444:12: note: previous definition is here
struct char_traits<wchar_t>
^
p793.cpp:95:35: error: use of undeclared identifier 'char16_t'
template<> struct char_traits<char16_t> {
^
p793.cpp:122:35: error: use of undeclared identifier 'char32_t'
template<> struct char_traits<char32_t> {
^
p793.cpp:149:26: error: redefinition of 'char_traits<wchar_t>'
template<> struct char_traits<wchar_t> {
^~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:444:12: note: previous definition is here
struct char_traits<wchar_t>
^
1 warning and 11 errors generated.
$ clang++ p793.cpp -std=2b -o p793l -I. -Wall
p793.cpp:25:18: error: unknown type name 'see_below'
using int_type = see_below;
^
p793.cpp:40:23: error: redefinition of 'char_traits<char>'
template<> struct char_traits<char> {
^~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:316:12: note: previous definition is here
struct char_traits<char>
^
p793.cpp:68:26: error: redefinition of 'char_traits<char8_t>'
template<> struct char_traits<char8_t> {
^~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:565:12: note: previous definition is here
struct char_traits<char8_t>
^
p793.cpp:95:23: error: redefinition of 'char_traits<char16_t>'
template<> struct char_traits<char16_t> {
^~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:699:12: note: previous definition is here
struct char_traits<char16_t>
^
p793.cpp:122:23: error: redefinition of 'char_traits<char32_t>'
template<> struct char_traits<char32_t> {
^~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:813:12: note: previous definition is here
struct char_traits<char32_t>
^
p793.cpp:149:26: error: redefinition of 'char_traits<wchar_t>'
template<> struct char_traits<wchar_t> {
^~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/char_traits.h:444:12: note: previous definition is here
struct char_traits<wchar_t>
^
6 errors generated.
$ g++ p793.cpp -std=03 -o p793g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from N4910.h:11,
from p793.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 \
| ^~~~~
p793.cpp:47:14: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
47 | static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
| ^~~~~~~~~
p793.cpp:47:72: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
47 | static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
| ^~~~~~~~
p793.cpp:25:7: error: expected nested-name-specifier before 'int_type'
25 | using int_type = see_below;
| ^~~~~~~~
p793.cpp:32:35: error: 'char8_t' was not declared in this scope; did you mean 'wchar_t'?
32 | template<> struct char_traits<char8_t>;
| ^~~~~~~
| wchar_t
p793.cpp:32:42: error: template argument 1 is invalid
32 | template<> struct char_traits<char8_t>;
| ^
p793.cpp:33:35: error: 'char16_t' was not declared in this scope
33 | template<> struct char_traits<char16_t>;
| ^~~~~~~~
p793.cpp:33:43: error: template argument 1 is invalid
33 | template<> struct char_traits<char16_t>;
| ^
p793.cpp:34:35: error: 'char32_t' was not declared in this scope
34 | template<> struct char_traits<char32_t>;
| ^~~~~~~~
p793.cpp:34:43: error: template argument 1 is invalid
34 | template<> struct char_traits<char32_t>;
| ^
p793.cpp:40:23: error: redefinition of 'struct std::char_traits<char>'
40 | template<> struct char_traits<char> {
| ^~~~~~~~~~~~~~~~~
In file included 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:
/usr/local/include/c++/12.1.0/bits/char_traits.h:335:12: note: previous definition of 'struct std::char_traits<char>'
335 | struct char_traits<char>
| ^~~~~~~~~~~~~~~~~
p793.cpp:68:38: error: 'char8_t' was not declared in this scope; did you mean 'wchar_t'?
68 | template<> struct char_traits<char8_t> {
| ^~~~~~~
| wchar_t
p793.cpp:68:45: error: template argument 1 is invalid
68 | template<> struct char_traits<char8_t> {
| ^
p793.cpp:95:35: error: 'char16_t' was not declared in this scope
95 | template<> struct char_traits<char16_t> {
| ^~~~~~~~
p793.cpp:95:43: error: template argument 1 is invalid
95 | template<> struct char_traits<char16_t> {
| ^
p793.cpp:122:35: error: 'char32_t' was not declared in this scope
122 | template<> struct char_traits<char32_t> {
| ^~~~~~~~
p793.cpp:122:43: error: template argument 1 is invalid
122 | template<> struct char_traits<char32_t> {
| ^
p793.cpp:149:26: error: redefinition of 'struct std::char_traits<wchar_t>'
149 | template<> struct char_traits<wchar_t> {
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/char_traits.h:473:12: note: previous definition of 'struct std::char_traits<wchar_t>'
473 | struct char_traits<wchar_t>
| ^~~~~~~~~~~~~~~~~~~~
$ g++ p793.cpp -std=2b -o p793g -I. -Wall
p793.cpp:25:18: error: 'see_below' does not name a type
25 | using int_type = see_below;
| ^~~~~~~~~
p793.cpp:40:23: error: redefinition of 'struct std::char_traits<char>'
40 | template<> struct char_traits<char> {
| ^~~~~~~~~~~~~~~~~
In file included 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 p793.cpp:10:
/usr/local/include/c++/12.1.0/bits/char_traits.h:335:12: note: previous definition of 'struct std::char_traits<char>'
335 | struct char_traits<char>
| ^~~~~~~~~~~~~~~~~
p793.cpp:68:26: error: redefinition of 'struct std::char_traits<char8_t>'
68 | template<> struct char_traits<char8_t> {
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/char_traits.h:601:12: note: previous definition of 'struct std::char_traits<char8_t>'
601 | struct char_traits<char8_t>
| ^~~~~~~~~~~~~~~~~~~~
p793.cpp:95:23: error: redefinition of 'struct std::char_traits<char16_t>'
95 | template<> struct char_traits<char16_t> {
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/char_traits.h:738:12: note: previous definition of 'struct std::char_traits<char16_t>'
738 | struct char_traits<char16_t>
| ^~~~~~~~~~~~~~~~~~~~~
p793.cpp:122:23: error: redefinition of 'struct std::char_traits<char32_t>'
122 | template<> struct char_traits<char32_t> {
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/char_traits.h:859:12: note: previous definition of 'struct std::char_traits<char32_t>'
859 | struct char_traits<char32_t>
| ^~~~~~~~~~~~~~~~~~~~~
p793.cpp:149:26: error: redefinition of 'struct std::char_traits<wchar_t>'
149 | template<> struct char_traits<wchar_t> {
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/char_traits.h:473:12: note: previous definition of 'struct std::char_traits<wchar_t>'
473 | struct char_traits<wchar_t>
| ^~~~~~~~~~~~~~~~~~~~
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
参考資料(reference)
関連する自己参照以外は、こちらの先頭に移転。
C言語(C++)に対する誤解、曲解、無理解、爽快。
#include "N4910.h"
C++N4910資料の改善点
dockerにclang
docker gnu(gcc/g++) and llvm(clang/clang++)
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
C++N4910:2022 tag follower 300人超えました。ありがとうございます。
astyle 使ってみた
DoCAP(ドゥーキャップ)って何ですか?
小川メソッド 覚え(書きかけ)
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20220804