はじめに(Introduction)
N4910 Working Draft, Standard for Programming Language C++
C++ n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 のWG21を含むいくつかのWGでは、可能な限り作業文書を公開し、幅広い意見を求めています。
ISO/IEC JTC1 SC7からISO/IEC JTC1 SC22リエゾンとして、2000年頃、C/C++の品質向上に貢献しようとした活動をしていたことがあります。その頃は、まだISO/IEC TS 17961の原案が出る前です。Cの精神が優勢で、セキュリティ対策は補助的な位置付けでした。ISO/IEC TS 17961の制定と、C/C++のライブラリ類の見直しと、C++の進化はどんどん進んでいきます。
進化の具合が、どちらに行こうとしているかは、コンパイルて実行させてみないとわかりません。C/C++の規格案の電子ファイルは、そのままコンパイルできる形式であるとよいと主張してきました。MISRA-C/C++, CERTC/C++でも同様です。MISRA-C/C++は、Example Suiteという形で、コード断片をコンパイルできる形で提供するようになりました。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, 箱庭プロジェクト、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.
30.3 Locales [locales] C++N4910:2022 (682) p1448.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 = "30.3 Locales [locales] C++N4910:2022 (682) p1448.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;
//
// 30.3.1 Class locale [locale]
// 30.3.1.1 General [locale.general]
namespace std {
class locale {
public:
// types
class facet;
class id;
using category = int;
static const category
// values assigned here are for exposition only
none = 0,
collate = 0x010, ctype = 0x020,
monetary = 0x040, numeric = 0x080,
time = 0x100, messages = 0x200,
all = collate | ctype | monetary | numeric | time | messages;
// construct/copy/destroy
locale() noexcept;
locale(const locale& other) noexcept;
explicit locale(const char* std_name);
explicit locale(const string& std_name);
locale(const locale& other, const char* std_name, category);
// 246) In this subclause, the type name tm is an incomplete type that is defined in <ctime> (29.14). § 30.3.1.1
locale(const locale& other, const string& std_name, category);
template<class Facet> locale(const locale& other, Facet* f);
locale(const locale& other, const locale& one, category);
~locale(); // not virtual
const locale& operator=(const locale& other) noexcept;
template<class Facet> locale combine(const locale& other) const;
// locale operations
string name() const;
bool operator==(const locale& other) const;
template<class charT, class traits, class Allocator>
bool operator()(const basic_string<charT, traits, Allocator>& s1,
const basic_string<charT, traits, Allocator>& s2) const;
// global locale objects
static locale global(const locale&);
static const locale& classic();
};
}
// Class locale implements a type-safe polymorphic set of facets, indexed by facet type. In other words, a facet has a dual role: in one sense, it’s just a class interface; at the same time, it’s an index into a locale’s set of facets.
// Access to the facets of a locale is via two function templates, use_facet<> and has_facet<>.
// [Example 1: An iostream operator<< can be implemented as:247
template<class charT, class traits>
basic_ostream<charT, traits>&
operator<< (basic_ostream<charT, traits>& s, Date d) {
typename basic_ostream<charT, traits>::sentry cerberos(s);
if (cerberos) {
tm tmbuf;
d.extract(tmbuf);
bool failed =
use_facet<time_put<charT, ostreambuf_iterator<charT, traits>>>(
s.getloc()).put(s, s, s.fill(), &tmbuf, 'x').failed();
if (failed)
s.setstate(s.badbit);
return s;
}
// can throw
}
// In the call to use_facet<Facet>(loc), the type argument chooses a facet, making available all members of the named type. If Facet is not present in a locale, it throws the standard exception bad_cast. A C++ program can check if a locale implements a particular facet with the function template has_facet<Facet>(). User-defined facets may be installed in a locale, and used identically as may standard facets.
// [Note 1: All locale semantics are accessed via use_facet<> and has_facet<>, except that:
// Once a facet reference is obtained from a locale object by calling use_facet<>, that reference remains usable, and the results from member functions of it may be cached and re-used, as long as some locale object refers to that facet.
// 247) Note that in the call to put, the stream is implicitly converted to an ostreambuf_iterator<charT, traits>.
// — A member operator template
operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
//is provided so that a locale can be used as a predicate argument to the standard collections, to collate strings.
// — Convenient global interfaces are provided for traditional ctype functions such as isdigit() and isspace(), so that given a locale object loc a C++ program can call isspace(c, loc). (This eases upgrading existing extractors (31.7.4.3).)
// In successive calls to a locale facet member function on a facet object installed in the same locale, the returned result shall be identical.
// A locale constructed from a name string (such as "POSIX"), or from parts of two named locales, has a name; all others do not. Named locales may be compared for equality; an unnamed locale is equal only to (copies of) itself. For an unnamed locale, locale::name() returns the string "*".
// Whether there is one global locale object for the entire program or one global locale object per thread is implementation-defined. Implementations should provide one global locale object per thread. If there is a single global locale object for the entire program, implementations are not required to avoid data races on it (16.4.6.10).
// 30.3.1.2 Types [locale.types]
// 30.3.1.2.1 Type locale::category [locale.category]
using category = int;
// Valid category values include the locale member bitmask elements collate, ctype, monetary, numeric, time, and messages, each of which represents a single locale category. In addition, locale member bitmask constant none is defined as zero and represents no category. And locale member bitmask constant all is defined such that the expression (collate | ctype | monetary | numeric | time | messages | all) == all
// is true, and represents the union of all categories. Further, the expression (X | Y), where X and Y each represent a single category, represents the union of the two categories.
// locale member functions expecting a category argument require one of the category values defined above, or the union of two or more such values. Such a category value identifies a set of locale categories. Each locale category, in turn, identifies a set of locale facets, including at least those shown in Table 100.
// Table 100: Locale category facets [tab:locale.category.facets]
Category Includes facets
collate collate<char>, collate<wchar_t>
ctype ctype<char>, ctype<wchar_t> codecvt<char, char, mbstate_t>
codecvt<char16_t, char8_t, mbstate_t>
codecvt<char32_t, char8_t, mbstate_t>
codecvt<wchar_t, char, mbstate_t>
monetary moneypunct<char>, moneypunct<wchar_t> moneypunct<char, true>, moneypunct<wchar_t, true> money_get<char>, money_get<wchar_t> money_put<char>, money_put<wchar_t>
numeric numpunct<char>, numpunct<wchar_t> num_get<char>, num_get<wchar_t> num_put<char>, num_put<wchar_t>
time time_get<char>, time_get<wchar_t> time_put<char>, time_put<wchar_t>
messages messages<char>, messages<wchar_t>
// For any locale loc either constructed, or returned by locale::classic(), and any facet Facet shown in Table 100, has_facet<Facet>(loc) is true. Each locale member function which takes a locale::category argument operates on the corresponding set of facets.
// An implementation is required to provide those specializations for facet templates identified as members of a category, and for those shown in Table 101.
// The provided implementation of members of facets num_get<charT> and num_put<charT> calls use_fac- et<F>(l) only for facet F of types numpunct<charT> and ctype<charT>, and for locale l the value obtained by calling member getloc() on the ios_base& argument to these functions.
// In declarations of facets, a template parameter with name InputIterator or OutputIterator indicates the set of all possible specializations on parameters that meet the Cpp17InputIterator requirements or
// Table 101: Required specializations [tab:locale.spec]
Category Includes facets
collate collate_byname<char>, collate_byname<wchar_t>
ctype ctype_byname<char>, ctype_byname<wchar_t> codecvt_byname<char, char, mbstate_t>
codecvt_byname<char16_t, char8_t, mbstate_t>
codecvt_byname<char32_t, char8_t, mbstate_t>
codecvt_byname<wchar_t, char, mbstate_t>
monetary moneypunct_byname<char, International> moneypunct_byname<wchar_t, International>
money_get<C, InputIterator>
money_put<C, OutputIterator>
numeric numpunct_byname<char>, numpunct_byname<wchar_t> num_get<C, InputIterator>, num_put<C, OutputIterator>
time time_get<char, InputIterator> time_get_byname<char, InputIterator>
time_get<wchar_t, InputIterator>
time_get_byname<wchar_t, InputIterator>
time_put<char, OutputIterator>
time_put_byname<char, OutputIterator>
time_put<wchar_t, OutputIterator>
time_put_byname<wchar_t, OutputIterator>
messages messages_byname<char>, messages_byname<wchar_t>
// Cpp17OutputIterator requirements, respectively (25.3). A template parameter with name C represents the set of types containing char, wchar_t, and any other implementation-defined character types that meet the requirements for a character on which any of the iostream components can be instantiated. A template parameter with name International represents the set of all possible specializations on a bool parameter.
// 0.3.1.2.2 Class locale::facet [locale.facet]
namespace std {
class locale::facet {
protected:
explicit facet(size_t refs = 0);
virtual ~facet();
facet(const facet&) = delete;
void operator=(const facet&) = delete;
};
}
// Class facet is the base class for locale feature sets. A class is a facet if it is publicly derived from another facet, or if it is a class derived from locale::facet and contains a publicly accessible declaration as follows:248
static ::std::locale::id id;
// Template parameters in this Clause which are required to be facets are those named Facet in declarations. A program that passes a type that is not a facet, or a type that refers to a volatile-qualified facet, as an (explicit or deduced) template parameter to a locale function expecting a facet, is ill-formed. A const-qualified facet is a valid template argument to any locale function that expects a Facet template parameter.
// The refs argument to the constructor is used for lifetime management. For refs == 0, the implementation performs delete static_cast<locale::facet*>(f) (where f is a pointer to the facet) when the last locale object containing the facet is destroyed; for refs == 1, the implementation never destroys the facet.
// Constructors of all facets defined in this Clause take such an argument and pass it along to their facet base class constructor. All one-argument constructors defined in this Clause are explicit, preventing their participation in implicit conversions.
// 248) This is a complete list of requirements; there are no other requirements. Thus, a facet class need not have a public copy constructor, assignment, default constructor, destructor, etc.
// Effects: Constructs a copy of the argument last passed to locale::global(locale&), if it has been called; else, the resulting facets have virtual function semantics identical to those of locale::classic().
// [Note 1: This constructor yields a copy of the current global locale. It is commonly used as a default argument for function parameters of type const locale&.
// For some standard facets a standard “. . ._byname” class, derived from it, implements the virtual function semantics equivalent to that facet of the locale constructed by locale(const char*) with the same name. Each such facet provides a constructor that takes a const char* argument, which names the locale, and a refs argument, which is passed to the base class constructor. Each such facet also provides a constructor that takes a string argument str and a refs argument, which has the same effect as calling the first constructor with the two arguments str.c_str() and refs. If there is no “. . ._byname” version of a facet, the base class implements named locale semantics itself by reference to other facets.
// 30.3.1.2.3 Class locale::id [locale.id]
namespace std {
class locale::id {
public:
id();
void operator=(const id&) = delete;
id(const id&) = delete;
};
}
// The class locale::id provides identification of a locale facet interface, used as an index for lookup and to encapsulate initialization.
// [Note 1: Because facets are used by iostreams, potentially while static constructors are running, their initialization cannot depend on programmed static initialization. One initialization strategy is for locale to initialize each facet’s id member the first time an instance of the facet is installed into a locale. This depends only on static storage being zero before constructors run (6.9.3.2). —end note]
// 30.3.1.3 Constructors and destructor [locale.cons]
locale() noexcept;
explicit locale(const char* std_name);
// Effects: Constructs a locale using standard C locale names, e.g., "POSIX". The resulting locale implements semantics defined to be associated with that name.
// Throws: runtime_error if the argument is not valid, or is null.
// Remarks: The set of valid string argument values is "C", "", and any implementation-defined values.
explicit locale(const string& std_name);
// Effects: The same as locale(std_name.c_str()). locale(const locale& other, const char* std_name, category);
// Effects: Constructs a locale as a copy of other except for the facets identified by the category argument, which instead implement the same semantics as locale(std_name).
// Throws: runtime_error if the argument is not valid, or is null.
// Remarks: The locale has a name if and only if other has a name.
locale(const locale& other, const string& std_name, category cat);
// Effects: The same as locale(other, std_name.c_str(), cat).
template<class Facet> locale(const locale& other, Facet* f);
// Effects: Constructs a locale incorporating all facets from the first argument except that of type Facet, and installs the second argument as the remaining facet. If f is null, the resulting object is a copy of other.
// Remarks: The resulting locale has no name.
locale(const locale& other, const locale& one, category cats);
// Effects: Constructs a locale incorporating all facets from the first argument except those that implement cats, which are instead incorporated from the second argument.
// Remarks: The resulting locale has a name if and only if the first two arguments have names.
const locale& operator=(const locale& other) noexcept;
// Effects: Creates a copy of other, replacing the current value. // Returns: *this.
// 30.3.1.4 Members [locale.members]
template<class Facet> locale combine(const locale& other) const;
// Effects: Constructs a locale incorporating all facets from *this except for that one facet of other that is identified by Facet.
// Returns: The newly created locale.
// Throws: runtime_error if has_facet<Facet>(other) is false. Remarks: The resulting locale has no name.
string name() const;
// Returns: The name of *this, if it has one; otherwise, the string "*".
// 30.3.1.5 Operators [locale.operators]
bool operator==(const locale& other) const;
// Returns: true if both arguments are the same locale, or one is a copy of the other, or each has a name and the names are identical; false otherwise.
template<class charT, class traits, class Allocator>
bool operator()(const basic_string<charT, traits, Allocator>& s1,
const basic_string<charT, traits, Allocator>& s2) const;
// Effects: Compares two strings according to the collate<charT> facet.
// Returns:
use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
s2.data(), s2.data() + s2.size()) < 0
// Remarks: This member operator template (and therefore locale itself) meets the requirements for a comparator predicate template argument (Clause 27) applied to strings.
// [Example 1: A vector of strings v can be collated according to collation rules in locale loc simply by (27.8.2, 24.3.11):
std::sort(v.begin(), v.end(), loc);
// 30.3.1.6 Static members [locale.statics]
static locale global(const locale& loc);
// Effects: Sets the global locale to its argument. Causes future calls to the constructor locale() to return a copy of the argument. If the argument has a name, does
setlocale(LC_ALL, loc.name().c_str());
// otherwise, the effect on the C locale, if any, is implementation-defined.
// Returns: The previous value of locale().
// Remarks: No library function other than locale::global() affects the value returned by locale().
// [Note 1: See 30.5 for data race considerations when setlocale is invoked.
static const locale& classic();
// The "C" locale.
// Returns: A locale that implements the classic "C" locale semantics, equivalent to the value locale("C"). Remarks: This locale, its facets, and their member functions, do not change with time.
// 30.3.2 locale globals [locale.global.templates]
template<class Facet> const Facet& use_facet(const locale& loc);
// Mandates: Facet is a facet class whose definition contains the public static member id as defined in 30.3.1.2.2.
// Returns: A reference to the corresponding facet of loc, if present.
// Throws: bad_cast if has_facet<Facet>(loc) is false.
// Remarks: The reference returned remains valid at least as long as any copy of loc exists.
template<class Facet> bool has_facet(const locale& loc) noexcept;
// Returns: true if the facet requested is present in loc; otherwise false.
// 30.3.3 Convenience interfaces [locale.convenience]
// 30.3.3.1 Character classification [classification]
template<class charT> bool isspace (charT c, const locale& loc);
template<class charT> bool isprint (charT c, const locale& loc);
template<class charT> bool iscntrl (charT c, const locale& loc);
template<class charT> bool isupper (charT c, const locale& loc);
template<class charT> bool islower (charT c, const locale& loc);
template<class charT> bool isalpha (charT c, const locale& loc);
template<class charT> bool isdigit (charT c, const locale& loc);
template<class charT> bool ispunct (charT c, const locale& loc);
template<class charT> bool isxdigit(charT c, const locale& loc);
template<class charT> bool isalnum (charT c, const locale& loc);
template<class charT> bool isgraph (charT c, const locale& loc);
template<class charT> bool isblank (charT c, const locale& loc);
// Each of these functions isF returns the result of the expression: use_facet<ctype<charT>>(loc).is(ctype_base::F, c)
// 30.3.3.2 Character conversions [conversions.character]
template<class charT> charT toupper(charT c, const locale& loc);
// Returns: use_facet<ctype<charT>>(loc).toupper(c).
template<class charT> charT tolower(charT c, const locale& loc);
// where F is the ctype_base::mask value corresponding to that function (30.4.2).249
// Returns: use_facet<ctype<charT>>(loc).tolower(c).
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
In file included from p1448.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 \
^
p1448.cpp:18:11: error: redefinition of 'locale'
class locale {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/locale_classes.h:62:9: note: previous definition is here
class locale
^
p1448.cpp:57:51: error: unknown type name 'Date'
operator<< (basic_ostream<charT, traits>& s, Date d) {
^
p1448.cpp:62:71: error: a space is required between consecutive right angle brackets (use '> >')
use_facet<time_put<charT, ostreambuf_iterator<charT, traits>>>(
^~
> >
p1448.cpp:74:36: error: use of undeclared identifier 'C'
operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
^
p1448.cpp:74:66: error: use of undeclared identifier 'C'
operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
^
p1448.cpp:82:4: error: expected function body after function declarator
using category = int;
^
p1448.cpp:87:3: error: unknown type name 'Category'
Category Includes facets
^
p1448.cpp:87:20: error: expected ';' after top level declarator
Category Includes facets
^
;
p1448.cpp:140:22: error: redefinition of 'id'
class locale::id {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/locale_classes.h:485:17: note: previous definition is here
class locale::id
^
p1448.cpp:149:11: error: expected unqualified-id
locale() noexcept;
^
p1448.cpp:150:17: error: expected unqualified-id
explicit locale(const char* std_name);
^
p1448.cpp:150:17: error: expected ')'
p1448.cpp:150:16: note: to match this '('
explicit locale(const char* std_name);
^
p1448.cpp:154:17: error: expected unqualified-id
explicit locale(const string& std_name);
^
p1448.cpp:154:17: error: expected ')'
p1448.cpp:154:16: note: to match this '('
explicit locale(const string& std_name);
^
p1448.cpp:159:8: error: expected unqualified-id
locale(const locale& other, const string& std_name, category cat);
^
p1448.cpp:159:8: error: expected ')'
p1448.cpp:159:7: note: to match this '('
locale(const locale& other, const string& std_name, category cat);
^
p1448.cpp:161:30: error: expected unqualified-id
template<class Facet> locale(const locale& other, Facet* f);
^
p1448.cpp:161:30: error: expected ')'
p1448.cpp:161:29: note: to match this '('
template<class Facet> locale(const locale& other, Facet* f);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p1448.cpp -std=2b -o p1448l -I. -Wall
p1448.cpp:18:11: error: redefinition of 'locale'
class locale {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/locale_classes.h:62:9: note: previous definition is here
class locale
^
p1448.cpp:57:51: error: unknown type name 'Date'
operator<< (basic_ostream<charT, traits>& s, Date d) {
^
p1448.cpp:74:36: error: use of undeclared identifier 'C'
operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
^
p1448.cpp:74:66: error: use of undeclared identifier 'C'
operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
^
p1448.cpp:82:4: error: expected function body after function declarator
using category = int;
^
p1448.cpp:87:3: error: unknown type name 'Category'
Category Includes facets
^
p1448.cpp:87:20: error: expected ';' after top level declarator
Category Includes facets
^
;
p1448.cpp:140:22: error: redefinition of 'id'
class locale::id {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/locale_classes.h:485:17: note: previous definition is here
class locale::id
^
p1448.cpp:149:11: error: expected unqualified-id
locale() noexcept;
^
p1448.cpp:150:17: error: expected unqualified-id
explicit locale(const char* std_name);
^
p1448.cpp:150:17: error: expected ')'
p1448.cpp:150:16: note: to match this '('
explicit locale(const char* std_name);
^
p1448.cpp:154:17: error: expected unqualified-id
explicit locale(const string& std_name);
^
p1448.cpp:154:17: error: expected ')'
p1448.cpp:154:16: note: to match this '('
explicit locale(const string& std_name);
^
p1448.cpp:159:8: error: expected unqualified-id
locale(const locale& other, const string& std_name, category cat);
^
p1448.cpp:159:8: error: expected ')'
p1448.cpp:159:7: note: to match this '('
locale(const locale& other, const string& std_name, category cat);
^
p1448.cpp:161:30: error: expected unqualified-id
template<class Facet> locale(const locale& other, Facet* f);
^
p1448.cpp:161:30: error: expected ')'
p1448.cpp:161:29: note: to match this '('
template<class Facet> locale(const locale& other, Facet* f);
^
p1448.cpp:164:11: error: expected unqualified-id
locale(const locale& other, const locale& one, category cats);
^
p1448.cpp:164:11: error: expected ')'
p1448.cpp:164:10: note: to match this '('
locale(const locale& other, const locale& one, category cats);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ g++ p1448.cpp -std=03 -o p1448g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from N4910.h:11,
from p1448.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 \
| ^~~~~
p1448.cpp:32:16: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
32 | locale() noexcept;
| ^~~~~~~~
p1448.cpp:18:11: error: redefinition of 'class std::locale'
18 | class locale {
| ^~~~~~
In file included 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/locale_classes.h:62:9: note: previous definition of 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:57:51: error: 'Date' has not been declared
57 | operator<< (basic_ostream<charT, traits>& s, Date d) {
| ^~~~
p1448.cpp: In function 'std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, int)':
p1448.cpp:60:22: error: request for member 'extract' in 'd', which is of non-class type 'int'
60 | tm tmbuf; d.extract(tmbuf);
| ^~~~~~~
p1448.cpp:62:71: error: '>>' should be '> >' within a nested template argument list
62 | use_facet<time_put<charT, ostreambuf_iterator<charT, traits>>>(
| ^~
| > >
p1448.cpp: At global scope:
p1448.cpp:74:36: error: 'C' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:39: error: 'T' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:42: error: 'A' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:43: error: template argument 1 is invalid
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:43: error: template argument 2 is invalid
p1448.cpp:74:43: error: template argument 3 is invalid
p1448.cpp:74:66: error: 'C' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:69: error: 'T' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:72: error: 'A' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:73: error: template argument 1 is invalid
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:73: error: template argument 2 is invalid
p1448.cpp:74:73: error: template argument 3 is invalid
p1448.cpp:82:4: error: expected constructor, destructor, or type conversion before 'using'
82 | using category = int;
| ^~~~~
p1448.cpp:87:3: error: 'Category' does not name a type
87 | Category Includes facets
| ^~~~~~~~
p1448.cpp:140:22: error: redefinition of 'class std::locale::id'
140 | class locale::id {
| ^~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:485:17: note: previous definition of 'class std::locale::id'
485 | class locale::id
| ^~
p1448.cpp:149:11: error: expected unqualified-id before ')' token
149 | locale() noexcept;
| ^
p1448.cpp:150:17: error: expected unqualified-id before 'const'
150 | explicit locale(const char* std_name);
| ^~~~~
p1448.cpp:150:17: error: expected ')' before 'const'
150 | explicit locale(const char* std_name);
| ~^~~~~
| )
p1448.cpp:154:17: error: expected unqualified-id before 'const'
154 | explicit locale(const string& std_name);
| ^~~~~
p1448.cpp:154:17: error: expected ')' before 'const'
154 | explicit locale(const string& std_name);
| ~^~~~~
| )
p1448.cpp:159:8: error: expected unqualified-id before 'const'
159 | locale(const locale& other, const string& std_name, category cat);
| ^~~~~
p1448.cpp:159:8: error: expected ')' before 'const'
159 | locale(const locale& other, const string& std_name, category cat);
| ~^~~~~
| )
p1448.cpp:161:30: error: expected unqualified-id before 'const'
161 | template<class Facet> locale(const locale& other, Facet* f);
| ^~~~~
p1448.cpp:161:30: error: expected ')' before 'const'
161 | template<class Facet> locale(const locale& other, Facet* f);
| ~^~~~~
| )
p1448.cpp:164:11: error: expected unqualified-id before 'const'
164 | locale(const locale& other, const locale& one, category cats);
| ^~~~~
p1448.cpp:164:11: error: expected ')' before 'const'
164 | locale(const locale& other, const locale& one, category cats);
| ~^~~~~
| )
p1448.cpp:167:46: error: expected initializer before 'noexcept'
167 | const locale& operator=(const locale& other) noexcept;
| ^~~~~~~~
p1448.cpp:170:59: error: non-member function 'std::locale combine(const std::locale&)' cannot have cv-qualifier
170 | template<class Facet> locale combine(const locale& other) const;
| ^~~~~
p1448.cpp:174:15: error: non-member function 'std::string name()' cannot have cv-qualifier
174 | string name() const;
| ^~~~~
p1448.cpp:177:38: error: non-member function 'bool operator==(const std::locale&)' cannot have cv-qualifier
177 | bool operator==(const locale& other) const;
| ^~~~~
p1448.cpp:177:6: error: 'bool operator==(const std::locale&)' must have exactly two arguments
177 | bool operator==(const locale& other) const;
| ^~~~~~~~
p1448.cpp:181:64: error: non-member function 'bool operator()(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)' cannot have cv-qualifier
181 | const basic_string<charT, traits, Allocator>& s2) const;
| ^~~~~
p1448.cpp:180:8: error: 'bool operator()(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)' must be a non-static member function
180 | bool operator()(const basic_string<charT, traits, Allocator>& s1,
| ^~~~~~~~
p1448.cpp:184:21: error: 'charT' was not declared in this scope; did you mean 'char'?
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~~
| char
p1448.cpp:184:26: warning: '>>' operator is treated as two right angle brackets in C++11 [-Wc++11-compat]
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~
p1448.cpp:184:26: note: suggest parentheses around '>>' expression
p1448.cpp:184:30: error: 'this' cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~
p1448.cpp:184:30: error: '*' cannot appear in a constant-expression
p1448.cpp:184:36: error: '.' cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~~~~
p1448.cpp:184:44: error: 's1' was not declared in this scope; did you mean 'y1'?
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~
| y1
p1448.cpp:184:47: error: '.' cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~
p1448.cpp:184:52: error: a function call cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^
p1448.cpp:184:55: error: 's1' was not declared in this scope; did you mean 'y1'?
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~
| y1
p1448.cpp:184:58: error: '.' cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~
p1448.cpp:184:63: error: a function call cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^
p1448.cpp:184:67: error: 's1' was not declared in this scope; did you mean 'y1'?
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~
| y1
p1448.cpp:184:70: error: '.' cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~
p1448.cpp:184:75: error: a function call cannot appear in a constant-expression
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^
p1448.cpp:185:44: error: 's2' was not declared in this scope
185 | s2.data(), s2.data() + s2.size()) < 0
| ^~
p1448.cpp:185:47: error: '.' cannot appear in a constant-expression
185 | s2.data(), s2.data() + s2.size()) < 0
| ^~~~
p1448.cpp:185:52: error: a function call cannot appear in a constant-expression
185 | s2.data(), s2.data() + s2.size()) < 0
| ^
p1448.cpp:185:55: error: 's2' was not declared in this scope
185 | s2.data(), s2.data() + s2.size()) < 0
| ^~
p1448.cpp:185:58: error: '.' cannot appear in a constant-expression
185 | s2.data(), s2.data() + s2.size()) < 0
| ^~~~
p1448.cpp:185:63: error: a function call cannot appear in a constant-expression
185 | s2.data(), s2.data() + s2.size()) < 0
| ^
p1448.cpp:185:67: error: 's2' was not declared in this scope
185 | s2.data(), s2.data() + s2.size()) < 0
| ^~
p1448.cpp:185:70: error: '.' cannot appear in a constant-expression
185 | s2.data(), s2.data() + s2.size()) < 0
| ^~~~
p1448.cpp:185:75: error: a function call cannot appear in a constant-expression
185 | s2.data(), s2.data() + s2.size()) < 0
| ^
p1448.cpp:185:76: error: a function call cannot appear in a constant-expression
185 | s2.data(), s2.data() + s2.size()) < 0
| ^
p1448.cpp:188:36: error: template argument 1 is invalid
188 | std::sort(v.begin(), v.end(), loc);
| ^
p1448.cpp:184:3: error: parse error in template argument list
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185 | s2.data(), s2.data() + s2.size()) < 0
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186 | // Remarks: This member operator template (and therefore locale itself) meets the requirements for a comparator predicate template argument (Clause 27) applied to strings.
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187 | // [Example 1: A vector of strings v can be collated according to collation rules in locale loc simply by (27.8.2, 24.3.11):
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 | std::sort(v.begin(), v.end(), loc);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1448.cpp:184:3: error: 'use_facet<<expression error> >' does not name a type
p1448.cpp:192:12: error: expected constructor, destructor, or type conversion before '(' token
192 | setlocale(LC_ALL, loc.name().c_str());
| ^
p1448.cpp:206:57: error: expected initializer before 'noexcept'
206 | template<class Facet> bool has_facet(const locale& loc) noexcept;
| ^~~~~~~~
p1448.cpp:190:15: warning: 'std::locale global(const std::locale&)' declared 'static' but never defined [-Wunused-function]
190 | static locale global(const locale& loc);
| ^~~~~~
p1448.cpp:197:25: warning: 'const std::locale& classic()' declared 'static' but never defined [-Wunused-function]
197 | static const locale& classic();
| ^~~~~~~
$ g++ p1448.cpp -std=2b -o p1448g -I. -Wall
p1448.cpp:18:11: error: redefinition of 'class std::locale'
18 | class locale {
| ^~~~~~
In file included from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
from /usr/local/include/c++/12.1.0/ios:42,
from /usr/local/include/c++/12.1.0/ostream:38,
from /usr/local/include/c++/12.1.0/iostream:39,
from N4910.h:2,
from p1448.cpp:10:
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: previous definition of 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:57:51: error: 'Date' has not been declared
57 | operator<< (basic_ostream<charT, traits>& s, Date d) {
| ^~~~
p1448.cpp: In function 'std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>&, int)':
p1448.cpp:60:22: error: request for member 'extract' in 'd', which is of non-class type 'int'
60 | tm tmbuf; d.extract(tmbuf);
| ^~~~~~~
p1448.cpp: At global scope:
p1448.cpp:74:36: error: 'C' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:39: error: 'T' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:42: error: 'A' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:43: error: template argument 1 is invalid
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:43: error: template argument 2 is invalid
p1448.cpp:74:43: error: template argument 3 is invalid
p1448.cpp:74:66: error: 'C' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:69: error: 'T' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:72: error: 'A' was not declared in this scope
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:73: error: template argument 1 is invalid
74 | operator()(const basic_string<C, T, A>&, const basic_string<C, T, A>&)
| ^
p1448.cpp:74:73: error: template argument 2 is invalid
p1448.cpp:74:73: error: template argument 3 is invalid
p1448.cpp:82:4: error: expected constructor, destructor, or type conversion before 'using'
82 | using category = int;
| ^~~~~
p1448.cpp:87:3: error: 'Category' does not name a type
87 | Category Includes facets
| ^~~~~~~~
p1448.cpp:140:22: error: redefinition of 'class std::locale::id'
140 | class locale::id {
| ^~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:485:17: note: previous definition of 'class std::locale::id'
485 | class locale::id
| ^~
p1448.cpp:149:21: error: expected constructor, destructor, or type conversion before ';' token
149 | locale() noexcept;
| ^
p1448.cpp:150:10: error: ISO C++ forbids declaration of 'locale' with no type [-fpermissive]
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:150:1: error: 'explicit' outside class declaration
150 | explicit locale(const char* std_name);
| ^~~~~~~~
p1448.cpp:154:10: error: reference to 'locale' is ambiguous
154 | explicit locale(const string& std_name);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:154:10: error: ISO C++ forbids declaration of 'locale' with no type [-fpermissive]
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:154:1: error: 'explicit' outside class declaration
154 | explicit locale(const string& std_name);
| ^~~~~~~~
p1448.cpp:159:14: error: reference to 'locale' is ambiguous
159 | locale(const locale& other, const string& std_name, category cat);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:159:53: error: 'category' has not been declared
159 | locale(const locale& other, const string& std_name, category cat);
| ^~~~~~~~
p1448.cpp:159:1: error: reference to 'locale' is ambiguous
159 | locale(const locale& other, const string& std_name, category cat);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:159:66: error: expected constructor, destructor, or type conversion before ';' token
159 | locale(const locale& other, const string& std_name, category cat);
| ^
p1448.cpp:161:36: error: reference to 'locale' is ambiguous
161 | template<class Facet> locale(const locale& other, Facet* f);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:161:23: error: reference to 'locale' is ambiguous
161 | template<class Facet> locale(const locale& other, Facet* f);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:161:60: error: expected constructor, destructor, or type conversion before ';' token
161 | template<class Facet> locale(const locale& other, Facet* f);
| ^
p1448.cpp:164:17: error: reference to 'locale' is ambiguous
164 | locale(const locale& other, const locale& one, category cats);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:164:38: error: reference to 'locale' is ambiguous
164 | locale(const locale& other, const locale& one, category cats);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:164:51: error: 'category' has not been declared
164 | locale(const locale& other, const locale& one, category cats);
| ^~~~~~~~
p1448.cpp:164:4: error: reference to 'locale' is ambiguous
164 | locale(const locale& other, const locale& one, category cats);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:164:65: error: expected constructor, destructor, or type conversion before ';' token
164 | locale(const locale& other, const locale& one, category cats);
| ^
p1448.cpp:167:7: error: reference to 'locale' is ambiguous
167 | const locale& operator=(const locale& other) noexcept;
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:170:23: error: reference to 'locale' is ambiguous
170 | template<class Facet> locale combine(const locale& other) const;
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:174:15: error: non-member function 'std::string name()' cannot have cv-qualifier
174 | string name() const;
| ^~~~~
p1448.cpp:177:23: error: reference to 'locale' is ambiguous
177 | bool operator==(const locale& other) const;
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:177:38: error: non-member function 'bool operator==(const int&)' cannot have cv-qualifier
177 | bool operator==(const locale& other) const;
| ^~~~~
p1448.cpp:177:6: error: 'bool operator==(const int&)' must have an argument of class or enumerated type
177 | bool operator==(const locale& other) const;
| ^~~~~~~~
p1448.cpp:181:64: error: non-member function 'bool operator()(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' cannot have cv-qualifier
181 | const basic_string<charT, traits, Allocator>& s2) const;
| ^~~~~
p1448.cpp:180:8: error: 'bool operator()(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' must be a non-static member function
180 | bool operator()(const basic_string<charT, traits, Allocator>& s1,
| ^~~~~~~~
p1448.cpp:184:21: error: 'charT' was not declared in this scope; did you mean 'char'?
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~~
| char
p1448.cpp:184:21: error: template argument 1 is invalid
p1448.cpp:184:3: error: specializing member '::use_facet<<expression error> >' requires 'template<>' syntax
184 | use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(),
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p1448.cpp:190:8: error: reference to 'locale' is ambiguous
190 | static locale global(const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:192:12: error: expected constructor, destructor, or type conversion before '(' token
192 | setlocale(LC_ALL, loc.name().c_str());
| ^
p1448.cpp:197:17: error: reference to 'locale' is ambiguous
197 | static const locale& classic();
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:201:52: error: reference to 'locale' is ambiguous
201 | template<class Facet> const Facet& use_facet(const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:206:44: error: reference to 'locale' is ambiguous
206 | template<class Facet> bool has_facet(const locale& loc) noexcept;
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:210:52: error: reference to 'locale' is ambiguous
210 | template<class charT> bool isspace (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:211:52: error: reference to 'locale' is ambiguous
211 | template<class charT> bool isprint (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:212:52: error: reference to 'locale' is ambiguous
212 | template<class charT> bool iscntrl (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:213:52: error: reference to 'locale' is ambiguous
213 | template<class charT> bool isupper (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:214:52: error: reference to 'locale' is ambiguous
214 | template<class charT> bool islower (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:215:52: error: reference to 'locale' is ambiguous
215 | template<class charT> bool isalpha (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:216:52: error: reference to 'locale' is ambiguous
216 | template<class charT> bool isdigit (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:217:52: error: reference to 'locale' is ambiguous
217 | template<class charT> bool ispunct (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:218:52: error: reference to 'locale' is ambiguous
218 | template<class charT> bool isxdigit(charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:219:52: error: reference to 'locale' is ambiguous
219 | template<class charT> bool isalnum (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:220:52: error: reference to 'locale' is ambiguous
220 | template<class charT> bool isgraph (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:221:52: error: reference to 'locale' is ambiguous
221 | template<class charT> bool isblank (charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:224:52: error: reference to 'locale' is ambiguous
224 | template<class charT> charT toupper(charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
p1448.cpp:226:52: error: reference to 'locale' is ambiguous
226 | template<class charT> charT tolower(charT c, const locale& loc);
| ^~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.h:62:9: note: candidates are: 'class std::locale'
62 | class locale
| ^~~~~~
p1448.cpp:154:10: note: 'int locale(const std::string&)'
154 | explicit locale(const string& std_name);
| ^~~~~~
p1448.cpp:150:10: note: 'int locale(const char*)'
150 | explicit locale(const char* std_name);
| ^~~~~~
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
応用例1 AUTOSAR C++
AUTOSARでC++のコーディング標準を作っている。
MISRA-C++コーディング標準の改訂をまたずに、C++14に対応したかったためかもしれない。
Autosar Guidelines C++14 example code compile list
MISRA C++, AUTOSAR C++について
応用例2 MISRA C/C++
MISRA C まとめ #include
MISRA C++ 5-0-16
応用例3 CERT C/C++
SEI CERT C++ Coding Standard AA. Bibliography 確認中。
MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする
応用例4 箱庭
箱庭もくもく会 #10 日時:2022/09/14(水) 17:30-19:30
箱庭ではUnityをはじめC++を使っているらしい。
ここでコンパイルしたコードと同じようなコードを使っているか、
ここで出たコンパイルエラーと同じようなエラーがでたかを
いろいろな版のコンパイラでコンパイルして確認していく。
この項目は、箱庭プロジェクトを市場分析の対象として、原則的には、箱庭プロジェクトの外部から分析し、外部から箱庭の広告宣伝のための戦略会議を仮想した結果、仮想「箱庭もくもく会」を開催してみることを企画するものである。
一切の内容は、箱庭プロジェクト、Athrill, TOPPERSとは無関係である。
一(いち)参加データアナリストの、個人的なつぶやきです。
仮想戦略会議「箱庭」
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(1)
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(2)
エンジニア夏休み企画
個人開発と読書感想文に焦点を当てたのは良い企画だと思った。
個人開発
【個人開発】 効率的な背景 <エンジニア夏休み企画>
Cコンパイラの試験を一人でもくもくとやっているのは個人開発の一つの姿です。
読書感想文
CコンパイラによるC言語規格の読書感想文として掲載しています。
コンパイル実験が、C++N4910に対する、G++とClang++による感想文だということご理解いただけると幸いです。
読書感想文は人間かAIだけが作るものとは限りません。
本(電子書籍を含む)を入力として、その内容に対する文字列を読書感想文として受け止めましょう。
元の文章をあり方、コンパイルできるように電子化しておくこと、コンパイラが解釈可能な断片の作り方など。
自己参考資料(self 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 使ってみた
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20220822