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.

31.5 Iostreams base classes [iostreams.base] C++N4910:2022 (688) p1492.cpp

Posted at

はじめに(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.

31.5 Iostreams base classes [iostreams.base] C++N4910:2022 (688) p1492.cpp

算譜(source code)

p1492.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 = " 31.5 Iostreams base classes [iostreams.base] C++N4910:2022 (688) p1492.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;

// 31.5.1 Header <ios> synopsis [ios.syn]
#include <iosfwd> // see 31.3.1
namespace std {
using streamoff = implementation_defined ;
using streamsize = implementation_defined;
template<class stateT> class fpos;
class ios_base;
template<class charT, class traits = char_traits<charT>>
class basic_ios;
// 31.5.5, manipulators
ios_base& boolalpha (ios_base& str);
ios_base& noboolalpha(ios_base& str);
ios_base& showbase   (ios_base& str);
ios_base& noshowbase (ios_base& str);
ios_base& showpoint  (ios_base& str);
ios_base& noshowpoint(ios_base& str);
ios_base& showpos    (ios_base& str);
ios_base& noshowpos  (ios_base& str);
ios_base& skipws     (ios_base& str);
ios_base& noskipws   (ios_base& str);
ios_base& uppercase  (ios_base& str);
ios_base& nouppercase(ios_base& str);
ios_base& unitbuf    (ios_base& str);
ios_base& nounitbuf  (ios_base& str);
// 31.5.5.2, adjustfield ios_base& internal ios_base& left ios_base& right
// 31.5.5.3, basefield ios_base& dec ios_base& hex ios_base& oct
// 31.5.5.4, floatfield ios_base& fixed
ios_base& scientific (ios_base& str);
ios_base& hexfloat (ios_base& str);
ios_base& defaultfloat(ios_base& str);
// 31.5.6, error reporting enum class io_errc {
stream = 1
};
(ios_base& str);
(ios_base& str);
(ios_base& str);
(ios_base& str);
(ios_base& str);
(ios_base& str);
(ios_base& str);
template<> struct is_error_code_enum<io_errc> : public true_type { };
error_code make_error_code(io_errc e) noexcept;
error_condition make_error_condition(io_errc e) noexcept;
const error_category& iostream_category() noexcept;
}
// 31.5.2 Class ios_base [ios.base]
// 31.5.2.1 General [ios.base.general]
namespace std {
class ios_base {
public:
    class failure;
// 31.5.2.2.2, fmtflags
    using fmtflags = T1;
    static constexpr fmtflags boolalpha = unspecified;
    s
    static constexpr fmtflags dec = unspecified;
    static constexpr fmtflags fixed = unspecified;
    static constexpr fmtflags hex = unspecified;
    static constexpr fmtflags internal = unspecified;
    static constexpr fmtflags left = unspecified;
    static constexpr fmtflags oct = unspecified;
    static constexpr fmtflags right = unspecified;
    static constexpr fmtflags scientific = unspecified;
    static constexpr fmtflags showbase = unspecified;
    static constexpr fmtflags showpoint = unspecified;
    static constexpr fmtflags showpos = unspecified;
    static constexpr fmtflags skipws = unspecified;
    static constexpr fmtflags unitbuf = unspecified;
    static constexpr fmtflags uppercase = unspecified;
    static constexpr fmtflags adjustfield = see_below;
    static constexpr fmtflags basefield = see_below;
    static constexpr fmtflags floatfield = see_below;
// 31.5.2.2.3, iostate
    using iostate = T2;
    static constexpr iostate badbit = unspecified;
    static constexpr iostate eofbit = unspecified;
    static constexpr iostate failbit = unspecified;
    static constexpr iostate goodbit = see_below;
// 31.5.2.2.4, openmode
    using openmode = T3;
    static constexpr openmode app = unspecified;
    static constexpr openmode ate = unspecified;
    static constexpr openmode binary = unspecified;
    static constexpr openmode in = unspecified;
    static constexpr openmode out = unspecified;
    static constexpr openmode trunc = unspecified;
// 31.5.2.2.5, seekdir
    using seekdir = T4;
    static constexpr seekdir beg = unspecified;
    static constexpr seekdir cur = unspecified;
    static constexpr seekdir end = unspecified;
    class Init;
// 31.5.2.3, fmtflags state
    fmtflags flags() const;
    fmtflags flags(fmtflags fmtfl);
    fmtflags setf(fmtflags fmtfl);
    fmtflags setf(fmtflags fmtfl, fmtflags mask);
// see below
// — a type failure, defined as either a class derived from system_error or a synonym for a class derived from system_error;
// — a class Init;
// — three bitmask types, fmtflags, iostate, and openmode;
// — an enumerated type, seekdir.
// — state information that reflects the integrity of the stream buffer;
// — control information that influences how to interpret (format) input sequences and how to generate (format) output sequences;
// — static int index, specifies the next available unique index for the integer or pointer arrays maintained for the private use of the program, initialized to an unspecified value;
// — long* iarray, points to the first element of an arbitrary-length long array maintained for the private use of the program;
// — void** parray, points to the first element of an arbitrary-length pointer array maintained for the private use of the program.
    void unsetf(fmtflags mask);
    streamsize precision() const;
    streamsize precision(streamsize prec);
    streamsize width() const;
    streamsize width(streamsize wide);
// 31.5.2.4, locales
    locale imbue(const locale& loc);
    locale getloc() const;
// 31.5.2.6, storage static int xalloc(); long& iword(int idx); void*& pword(int idx);
// destructor
    virtual ~ios_base();
// 31.5.2.7, callbacks
    enum event { erase_event, imbue_event, copyfmt_event };
    using event_callback = void (*)(event, ios_base&, int idx);
    void register_callback(event_callback fn, int idx);
    ios_base(const ios_base&) = delete;
    ios_base& operator=(const ios_base&) = delete;
    static bool sync_with_stdio(bool sync = true);
protected:
    ios_base();
private:
    static int index;
    long*  iarray;
    void** parray;
};
}
// exposition only // exposition only // exposition only
//  ios_base defines several member types:
//  It maintains several kinds of data:
//  [Note 1: For the sake of exposition, the maintained data is presented here as:
// — additional information that is stored by the program for its private use.
// Effects: Constructs the base class with msg and ec.
// 31.5.2.2 Types [ios.types]
// 31.5.2.2.1 Class ios_base::failure [ios.failure]
namespace std {
class ios_base::failure : public system_error {
public:
    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
    explicit failure(const char* msg, const error_code& ec = io_errc::stream);
};
}
//  An implementation is permitted to define ios_base::failure as a synonym for a class with equivalent functionality to class ios_base::failure shown in this subclause.
// [Note 1: When ios_base::failure is a synonym for another type, that type is required to provide a nested type failure to emulate the injected-class-name.
// The class failure defines the base class for the types of all objects thrown as exceptions, by functions in the iostreams library, to report errors detected during stream buffer operations.
//  When throwing ios_base::failure exceptions, implementations should provide values of ec that identify the specific reason for the failure.
// [Note 2: Errors arising from the operating system would typically be reported as system_category() errors with an error value of the error number reported by the operating system. Errors arising from within the stream library would typically be reported as error_code(io_errc::stream, iostream_category()).
explicit failure(const string& msg, const error_code& ec = io_errc::stream);
// Effects: Constructs the base class with msg and ec.
explicit failure(const char* msg, const error_code& ec = io_errc::stream);
// 31.5.2.2.2 Type ios_base::fmtflags [ios.fmtflags]
using fmtflags = T1;
// The type fmtflags is a bitmask type (16.3.3.3.4). Setting its elements has the effects indicated in
//Type fmtflags also defines the constants indicated in Table 115.
using iostate = T2;
// 31.5.2.2.3 Type ios_base::iostate [ios.iostate]
// 31.5.2.2.4 Type ios_base::openmode  [ios.openmode]
using openmode = T3;
// 31.5.2.2.5 Type ios_base::seekdir [ios.seekdir]
using seekdir = T4;
~Init();
// Effects: If there are no other instances of the class still in existence, calls cout.flush(), cerr.flush(), clog.flush(), wcout.flush(), wcerr.flush(), wclog.flush().
// 31.5.2.3 State functions [fmtflags.state]
fmtflags flags() const;
// 31.5.2.2.6 Class ios_base::Init [ios.init]
namespace std {
class ios_base::Init {
public:
    Init();
    Init(const Init&) = default;
    ~Init();
    Init& operator=(const Init&) = default;
private:
    static int init_cnt; // exposition only
};
}
//  The class Init describes an object whose construction ensures the construction of the eight objects declared in <iostream> (31.4) that associate file stream buffers with the standard C streams provided for by the functions declared in <cstdio> (31.13.1).
//  For the sake of exposition, the maintained data is presented here as:
// — static to zero.
Init();
// Effects: if they have not already been constructed and initialized.
// Returns: The format control information for both input and output.
fmtflags flags(fmtflags fmtfl);
// Postconditions: fmtfl == flags(). Returns: The previous value of flags().
fmtflags setf(fmtflags fmtfl);
// Effects: Sets fmtfl in flags().
// Returns: The previous value of flags().
fmtflags setf(fmtflags fmtfl, fmtflags mask);
// Effects: Clears mask in flags(), sets fmtfl & mask in flags(). Returns: The previous value of flags().
void unsetf(fmtflags mask);
// Effects: Clears mask in flags(). streamsize precision() const;
// Returns: The precision to generate on certain output conversions.
streamsize precision(streamsize prec);
// Postconditions: prec == precision(). Returns: The previous value of precision().
streamsize width() const;
// Returns: The minimum field width (number of characters) to generate on certain output conversions.
// Returns: index ++.
// Remarks: Concurrent access to this function by multiple threads does not result in a data race (6.9.2).
streamsize width(streamsize wide);
// Postconditions: wide == width(). Returns: The previous value of width().
// 31.5.2.4 Functions  [ios.base.locales]
locale imbue(const locale& loc);
// Effects: Calls each registered callback pair (fn, idx) (31.5.2.7) as (*fn)(imbue_event, *this, idx) at such a time that a call to ios_base::getloc() from within fn returns the new locale value loc.
// Postconditions: loc == getloc(). Returns: The previous value of getloc().
locale getloc() const;
// Returns: If no locale has been imbued, a copy of the global C++ locale, locale(), in effect at the time of construction. Otherwise, returns the imbued locale, to be used to perform locale-dependent input and output operations.
// 31.5.2.5 Static members [ios.members.static]
static bool sync_with_stdio(bool sync = true);
// Effects: If any input or output operation has occurred using the standard streams prior to the call, the effect is implementation-defined. Otherwise, called with a false argument, it allows the standard streams to operate independently of the standard C streams.
// Returns: true if the previous state of the standard iostream objects (31.4) was synchronized and otherwise returns false. The first time it is called, the function returns true.
// Remarks: When a standard iostream object str is synchronized with a standard stdio stream f, the effect of inserting a character c by
fputc(f, c);
// is the same as the effect of
str.rdbuf()->sputc(c);
// for any sequences of characters; the effect of extracting a character c by c = fgetc(f);
// is the same as the effect of
c = str.rdbuf()->sbumpc();
// for any sequences of characters; and the effect of pushing back a character c by ungetc(c, f);
// is the same as the effect of
str.rdbuf()->sputbackc(c);
// for any sequence of characters.275
// 31.5.2.6 Storage functions [ios.base.storage]
static int xalloc();
long& iword(int idx);
// Preconditions: idx is a value obtained by a call to xalloc.
// Effects: If iarray is a null pointer, allocates an array of long of unspecified size and stores a pointer to its first element in iarray. The function then extends the array pointed at by iarray as necessary
// 275) This implies that operations on a standard iostream object can be mixed arbitrarily with operations on the corresponding stdio stream. In practical terms, synchronization usually means that a standard iostream object and a standard stdio object share a buffer.to include the element iarray[idx]. Each newly allocated element of the array is initialized to zero. The reference returned is invalid after any other operations on the object.276 However, the value of the storage referred to is retained, so that until the next call to copyfmt, calling iword with the same index yields another reference to the same value. If the function fails277 and *this is a base class subobject of a basic_ios<> object or subobject, the effect is equivalent to calling basic_ios<>::setstate(badbit) on the derived object (which may throw failure).
// Returns: On success iarray[idx]. On failure, a valid long& initialized to 0.
void*& pword(int idx);
// Preconditions: idx is a value obtained by a call to xalloc.
// Effects: If parray is a null pointer, allocates an array of pointers to void of unspecified size and stores a pointer to its first element in parray. The function then extends the array pointed at by parray as necessary to include the element parray[idx]. Each newly allocated element of the array is initialized to a null pointer. The reference returned is invalid after any other operations on the object. However, the value of the storage referred to is retained, so that until the next call to copyfmt, calling pword with the same index yields another reference to the same value. If the function fails278 and *this is a base class subobject of a basic_ios<> object or subobject, the effect is equivalent to calling basic_ios<>::setstate(badbit) on the derived object (which may throw failure).
// Returns: On success parray[idx]. On failure a valid void*& initialized to 0.
// Remarks: After a subsequent call to pword(int) for the same object, the earlier return value may no longer be valid.
// 31.5.2.7 Callbacks [ios.base.callback]
void register_callback(event_callback fn, int idx);
// Preconditions: The function fn does not throw exceptions.
// Effects: Registers the pair (fn, idx) such that during calls to imbue() (31.5.2.4), copyfmt(), or ~ios_base() (31.5.2.8), the function fn is called with argument idx. Functions registered are called when an event occurs, in opposite order of registration. Functions registered while a callback function is active are not called until the next event.
// Remarks: Identical pairs are not merged. A function registered twice will be called twice.
// 31.5.2.8 Constructors and destructor [ios.base.cons]
ios_base();
//Effects: Each ios_base member has an indeterminate value after construction. The object’s members shall be initialized by calling basic_ios::init before the object’s first use or before it is destroyed, whichever comes first; otherwise the behavior is undefined.
~ios_base();
//Effects: Calls each registered callback pair (fn, idx) (31.5.2.7) as (*fn)(erase_event, *this, idx) at such time that any ios_base member function called from within fn has well-defined results. Then, any memory obtained is deallocated.
// 31.5.3 Class template fpos [fpos]
namespace std {
template<class stateT> class fpos {
public:
// 31.5.3.1, members stateT state() const; void state(stateT);
    private;
    stateT st;
// exposition only
//  276) An implementation is free to implement both the integer array pointed at by iarray and the pointer array pointed at by parray as sparse data structures, possibly with a one-element cache for each.
// 277) For example, because it cannot allocate space.
// 278) For example, because it cannot allocate space.
// — P refers to a specialization of fpos,
// — pandqrefertovaluesoftypePorconst P,
// — pl and ql refer to modifiable lvalues of type P,
// — O refers to type streamoff, and
// — o refers to a value of type streamoff or const streamoff.
// Table 119: Position type requirements [tab:fpos.operations]
};
}
// 31.5.3.1 Members [fpos.members]
void state(stateT s);
// Effects: Assigns s to st. stateT state() const;
// Returns: Current value of st.
// 31.5.3.2 Requirements [fpos.operations]
//  An fpos type specifies file position information. It holds a state object whose type is equal to the template pa- rameter stateT. Type stateT shall meet the Cpp17DefaultConstructible (Table 29), Cpp17CopyConstructible
P p(o);
// Effects: Value-initializes the
P p = o;
state object.
// Postconditions: p == P(o)
//  Stream operations that return a value of type traits::pos_type return P(O(-1)) as an invalid value to signal an error. If this value is used as an argument to any istream, ostream, or streambuf member that accepts a value of type traits::pos_type then the behavior of that function is undefined.
// 31.5.4 Class template basic_ios  [ios]
// 31.5.4.1 Overview [ios.overview]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_ios : public ios_base {
public:
    using char_type = charT;
    using int_type = typename traits::int_type;
    using pos_type = typename traits::pos_type;
    using off_type = typename traits::off_type;
    using traits_type = traits;
// 31.5.4.4, flags functions
    explicit operator bool() const;
    bool operator!() const;
    iostate rdstate() const;
    void clear(iostate state = goodbit);
    void setstate(iostate state);
    bool good() const;
    bool eof() const;
    bool fail() const;
    bool bad() const;
    iostate exceptions() const;
    void exceptions(iostate except);
// 31.5.4.2, constructor/destructor
    explicit basic_ios(basic_streambuf<charT, traits>* sb);
    virtual ~basic_ios();
// 31.5.4.3, members
    basic_ostream<charT, traits>* tie() const;
    basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
    basic_streambuf<charT, traits>* rdbuf() const;
    basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
    basic_ios& copyfmt(const basic_ios& rhs);
    char_type fill() const;
    char_type fill(char_type ch);
    locale imbue(const locale& loc);
    char      narrow(char_type c, char dfault) const;
    char_type widen(char c) const;
    basic_ios(const basic_ios&) = delete;
    basic_ios& operator=(const basic_ios&) = delete;
protected:
    basic_ios();
    void init(basic_streambuf<charT, traits>* sb);
    void move(basic_ios& rhs);
    void move(basic_ios&& rhs);
    void swap(basic_ios& rhs) noexcept;
    void set_rdbuf(basic_streambuf<charT, traits>* sb);
};
}
// Returns: An output sequence that is tied to (synchronized with) the sequence controlled by the stream buffer.
// Effects: Leaves its member objects uninitialized. The object shall be initialized by calling basic_- ios::init before its first use or before it is destroyed, whichever comes first; otherwise the behavior is undefined.
// 31.5.4.2 Constructors [basic.ios.cons]
explicit basic_ios(basic_streambuf<charT, traits>* sb);
// Effects: Assigns initial values to its member objects by calling init(sb). basic_ios();
~basic_ios();
// Remarks: The destructor does not destroy rdbuf().
void init(basic_streambuf<charT, traits>* sb);
// Postconditions: The postconditions of this function are indicated in // Table 120. Table 120: basic_ios::init() effects [tab:basic.ios.cons]
//  31.5.4.3 Member functions [basic.ios.members]
basic_ostream<charT, traits>* tie() const;
basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
// Preconditions: If tiestr is not null, tiestr is not reachable by traversing the linked list of tied stream objects starting from tiestr->tie().
// Postconditions: tiestr == tie(). Returns: The previous value of tie().
basic_streambuf<charT, traits>* rdbuf() const;
// Returns: A pointer to the streambuf associated with the stream.
basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
// Effects: Calls clear().
// Postconditions: sb == rdbuf(). Returns: The previous value of rdbuf().
locale imbue(const locale& loc);
// Effects: Calls ios_base::imbue(loc) (31.5.2.4) and if rdbuf() != 0 then rdbuf()->pubimbue(loc) (31.6.3.3.1).
// Returns: The prior value of ios_base::imbue().
char narrow(char_type c, char dfault) const;
// Returns: use_facet<ctype<char_type>>(getloc()).narrow(c, dfault) char_type widen(char c) const;
// Returns: use_facet<ctype<char_type>>(getloc()).widen(c)
char_type fill() const;
// Returns: The character used to pad (fill) an output conversion to the specified field width.
char_type fill(char_type fillch);
// Postconditions: traits::eq(fillch, fill()). Returns: The previous value of fill().
basic_ios& copyfmt(const basic_ios& rhs);
// Effects: If (this == addressof(rhs)) is true does nothing. Otherwise assigns to the member objects of *this the corresponding member objects of rhs as follows:
// — calls each registered callback pair (fn, idx) as (*fn)(erase_event, *this, idx);
// — then, assigns to the member objects of *this the corresponding member objects of rhs, except that
// — rdstate(), rdbuf(), and exceptions() are left unchanged;
// — the contents of arrays pointed at by pword and iword are copied, not the pointers themselves;279 and
// — if any newly stored pointer values in *this point at objects stored outside the object rhs and those objects are destroyed when rhs is destroyed, the newly stored pointer values are altered to point at newly constructed copies of the objects;
// — then, calls each callback pair that was copied from rhs as (*fn)(copyfmt_event, *this, idx);
// — then, calls exceptions(rhs.exceptions()).
// [Note 1: The second pass through the callback pairs permits a copied pword value to be zeroed, or to have its referent deep copied or reference counted, or to have other special action taken.
// Postconditions: The postconditions of this function are indicated in Table 121.
// Table 121: basic_ios::copyfmt() effects
// Returns: *this.
void move(basic_ios& rhs);
void move(basic_ios&& rhs);
// Postconditions: *this has the state that rhs had before the function call, except that rdbuf() returns nullptr. rhs is in a valid but unspecified state, except that rhs.rdbuf() returns the same value as it returned before the function call, and rhs.tie() returns nullptr.
//  279) This suggests an infinite amount of copying, but the implementation can keep track of the maximum element of the arrays that is nonzero.
void swap(basic_ios& rhs) noexcept;
// Effects: The states of *this and rhs are exchanged, except that rdbuf() returns the same value as it returned before the function call, and rhs.rdbuf() returns the same value as it returned before the function call.
void set_rdbuf(basic_streambuf<charT, traits>* sb);
// Preconditions: sb != nullptr is true.
// Effects: Associates the basic_streambuf object pointed to by sb with this stream without calling clear().
// Postconditions: rdbuf() == sb is true. Throws: Nothing.
// 31.5.4.4 Flags functions [iostate.flags]
explicit operator bool() const;
// Returns: !fail().
bool operator!() const;
// Returns: fail().
iostate rdstate() const;
// Returns: The error state of the stream buffer.
void clear(iostate state = goodbit);
// Effects: If ((state | (rdbuf() ? goodbit : badbit)) & exceptions()) == 0, returns. Oth- erwise, the function throws an object of class ios_base::failure (31.5.2.2.1), constructed with implementation-defined argument values.
// Postconditions: If rdbuf() != 0 then state == rdstate(); otherwise rdstate() == (state | ios_base::badbit).
void setstate(iostate state);
// Effects: Calls clear(rdstate() | state) (which may throw ios_base::failure (31.5.2.2.1)). bool good() const;
// Returns: rdstate() == 0
bool eof() const;
// Returns: true if eofbit is set in rdstate().
bool fail() const;
// Returns: true if failbit or badbit is set in rdstate().280
bool bad() const;
// Returns: true if badbit is set in rdstate().
iostate exceptions() const;
// Returns: A mask that determines what elements set in rdstate() cause exceptions to be thrown.
void exceptions(iostate except);
// Effects: Calls clear(rdstate()). Postconditions: except == exceptions().
// 31.5.5 ios_base manipulators [std.ios.manip]
// 31.5.5.1 fmtflags manipulators [fmtflags.manip]
//  Each function specified in this subclause is a designated addressable function (16.4.5.2.1).
// 280) Checking badbit also for fail() is historical practice.
ios_base& boolalpha(ios_base& str);
// Effects: Calls str.setf(ios_base::boolalpha). Returns: str.
ios_base& noboolalpha(ios_base& str);
// Effects: Calls str.unsetf(ios_base::boolalpha). Returns: str.
ios_base& showbase(ios_base& str);
// Effects: Calls str.setf(ios_base::showbase). Returns: str.
ios_base& noshowbase(ios_base& str);
// Effects: Calls str.unsetf(ios_base::showbase). Returns: str.
ios_base& showpoint(ios_base& str);
// Effects: Calls str.setf(ios_base::showpoint). Returns: str.
ios_base& noshowpoint(ios_base& str);
// Effects: Calls str.unsetf(ios_base::showpoint). Returns: str.
ios_base& showpos(ios_base& str);
// Effects: Calls str.setf(ios_base::showpos). Returns: str.
ios_base& noshowpos(ios_base& str);
// Effects: Calls str.unsetf(ios_base::showpos). Returns: str.
ios_base& skipws(ios_base& str);
// Effects: Calls str.setf(ios_base::skipws). Returns: str.
ios_base& noskipws(ios_base& str);
// Effects: Calls str.unsetf(ios_base::skipws). Returns: str.
ios_base& uppercase(ios_base& str);
// Effects: Calls str.setf(ios_base::uppercase). Returns: str.
ios_base& nouppercase(ios_base& str);
// Effects: Calls str.unsetf(ios_base::uppercase). Returns: str.
ios_base& unitbuf(ios_base& str);
// Effects: Calls str.setf(ios_base::unitbuf). Returns: str.
ios_base& nounitbuf(ios_base& str);
// Effects: Calls str.unsetf(ios_base::unitbuf).
// Effects: Calls str.unsetf(ios_base::floatfield). Returns: str.
// Effects: Calls str.setf(ios_base::internal, ios_base::adjustfield).
// Returns: str.
// Effects: Calls str.setf(ios_base::dec, ios_base::basefield). Returns: str.281
// Effects: Calls str.setf(ios_base::fixed, ios_base::floatfield). Returns: str.
// Returns: str.
// 31.5.5.2 adjustfield manipulators [adjustfield.manip]
//  Each function specified in this subclause is a designated addressable function (16.4.5.2.1).
ios_base& internal(ios_base& str);
ios_base& left(ios_base& str);
// Effects: Calls str.setf(ios_base::left, ios_base::adjustfield). Returns: str.
ios_base& right(ios_base& str);
// Effects: Calls str.setf(ios_base::right, ios_base::adjustfield). Returns: str.
// 31.5.5.3 basefield manipulators [basefield.manip]
//  Each function specified in this subclause is a designated addressable function (16.4.5.2.1).
ios_base& dec(ios_base& str);
ios_base& hex(ios_base& str);
// Effects: Calls str.setf(ios_base::hex, ios_base::basefield). Returns: str.
ios_base& oct(ios_base& str);
// Effects: Calls str.setf(ios_base::oct, ios_base::basefield). Returns: str.
// 31.5.5.4 floatfield manipulators [floatfield.manip]
//  Each function specified in this subclause is a designated addressable function (16.4.5.2.1).
ios_base& fixed(ios_base& str);
ios_base& scientific(ios_base& str);
// Effects: Calls str.setf(ios_base::scientific, ios_base::floatfield). Returns: str.
ios_base& hexfloat(ios_base& str);
// Effects: Calls str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield). Returns: str.
//  [Note 1: ios_base::hex cannot be used to specify a hexadecimal floating-point format, because it is not part of ios_base::floatfield (Table 115). —end note]
ios_base& defaultfloat(ios_base& str);
//  281) The function signature dec(ios_base&) can be called by the function signature basic_ostream& stream::operator<<(ios_- base& (*)(ios_base&)) to permit expressions of the form cout << dec to change the format flags stored in cout.
// — the beginning pointer, or lowest element address in the array (called xbeg here);
// — the next pointer, or next element address that is a current candidate for reading or writing (called
xnext here);
// — the end pointer, or first element address beyond the end of the array (called xend here). pointer names given immediately above:
// — If xnext is not a null pointer, then xbeg and xend shall also be non-null pointers into the same charT
// Returns: error_condition(static_cast<int>(e), iostream_category()).
// 31.5.6 Error reporting [error.reporting]
error_code make_error_code(io_errc e) noexcept;
// Returns: error_code(static_cast<int>(e), iostream_category()). error_condition make_error_condition(io_errc e) noexcept;
const error_category& iostream_category() noexcept;
}
// Returns: A reference to an object of a type derived from class error_category.
// The object’s default_error_condition and equivalent virtual functions shall behave as specified for the class error_category. The object’s name virtual function shall return a pointer to the string "iostream".
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

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

bash
$ clang++ p1492.cpp -std=03 -o p1492l -I. -Wall
In file included from p1492.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 \
 ^
p1492.cpp:17:19: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using streamoff = implementation_defined ; 
                  ^
p1492.cpp:17:19: error: unknown type name 'implementation_defined'
p1492.cpp:18:20: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using streamsize = implementation_defined; 
                   ^
p1492.cpp:18:20: error: unknown type name 'implementation_defined'
p1492.cpp:21:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1492.cpp:21:42: error: template parameter redefines default argument
    template<class charT, class traits = char_traits<charT>>
                                         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:76:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1492.cpp:45:1: error: C++ requires a type specifier for all declarations
stream = 1 };
^
p1492.cpp:45:11: error: expected ';' after top level declarator
stream = 1 };
          ^
          ;
p1492.cpp:46:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:46:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:46:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:47:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:47:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:47:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:48:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:48:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:48:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:49:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:49:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:49:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:50:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:50:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:50:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:51:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:51:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:51:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
$ clang++ p1492.cpp -std=2b -o p1492l -I. -Wall
p1492.cpp:17:19: error: unknown type name 'implementation_defined'
using streamoff = implementation_defined ; 
                  ^
p1492.cpp:18:20: error: unknown type name 'implementation_defined'
using streamsize = implementation_defined; 
                   ^
p1492.cpp:21:42: error: template parameter redefines default argument
    template<class charT, class traits = char_traits<charT>>
                                         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:76:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1492.cpp:45:1: error: C++ requires a type specifier for all declarations
stream = 1 };
^
p1492.cpp:45:11: error: expected ';' after top level declarator
stream = 1 };
          ^
          ;
p1492.cpp:46:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:46:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:46:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:47:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:47:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:47:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:48:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:48:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:48:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:49:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:49:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:49:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:50:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:50:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:50:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:51:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:51:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:51:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
p1492.cpp:52:10: error: expected ')'
(ios_base& str);
         ^
p1492.cpp:52:1: note: to match this '('
(ios_base& str);
^
p1492.cpp:52:2: error: C++ requires a type specifier for all declarations
(ios_base& str);
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1492.cpp -std=03 -o p1492g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1492.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 \
      |  ^~~~~
p1492.cpp:54:39: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   54 | error_code make_error_code(io_errc e) noexcept;
      |                                       ^~~~~~~~
p1492.cpp:66:8: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   66 | static constexpr fmtflags boolalpha = unspecified; s
      |        ^~~~~~~~~
p1492.cpp:17:7: error: expected nested-name-specifier before 'streamoff'
   17 | using streamoff = implementation_defined ;
      |       ^~~~~~~~~
p1492.cpp:18:7: error: expected nested-name-specifier before 'streamsize'
   18 | using streamsize = implementation_defined;
      |       ^~~~~~~~~~
p1492.cpp:21:59: error: spurious '>>', use '>' to terminate a template argument list
   21 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1492.cpp:22:13: error: template argument required for 'class basic_ios'
   22 |       class basic_ios;
      |             ^~~~~~~~~
p1492.cpp:21:42: error: two or more data types in declaration of 'type name'
   21 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1492.cpp:22:22: error: expected '>' before ';' token
   22 |       class basic_ios;
      |                      ^
p1492.cpp:22:22: error: expected unqualified-id before ';' token
p1492.cpp:45:1: error: 'stream' does not name a type; did you mean 'ostream'?
   45 | stream = 1 };
      | ^~~~~~
      | ostream
p1492.cpp:46:10: error: expected ')' before '&' token
   46 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:47:10: error: expected ')' before '&' token
   47 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:48:10: error: expected ')' before '&' token
   48 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:49:10: error: expected ')' before '&' token
   49 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:50:10: error: expected ')' before '&' token
   50 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:51:10: error: expected ')' before '&' token
   51 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:52:10: error: expected ')' before '&' token
   52 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:53:19: error: 'is_error_code_enum' is not a class template
   53 | template<> struct is_error_code_enum<io_errc> : public true_type { };
      |                   ^~~~~~~~~~~~~~~~~~
p1492.cpp:53:38: error: 'io_errc' was not declared in this scope
   53 | template<> struct is_error_code_enum<io_errc> : public true_type { };
      |                                      ^~~~~~~
p1492.cpp:53:66: error: expected class-name before '{' token
   53 | template<> struct is_error_code_enum<io_errc> : public true_type { };
      |                                                                  ^
p1492.cpp:53:66: error: explicit specialization of non-template 'is_error_code_enum'
p1492.cpp:54:1: error: 'error_code' does not name a type
   54 | error_code make_error_code(io_errc e) noexcept;
      | ^~~~~~~~~~
p1492.cpp:55:1: error: 'error_condition' does not name a type
   55 | error_condition make_error_condition(io_errc e) noexcept;
      | ^~~~~~~~~~~~~~~
p1492.cpp:56:7: error: 'error_category' does not name a type
   56 | const error_category& iostream_category() noexcept;
      |       ^~~~~~~~~~~~~~
p1492.cpp:57:1: error: expected declaration before '}' token
   57 | }
      | ^
p1492.cpp:61:11: error: redefinition of 'class std::ios_base'
   61 |     class ios_base {
      |           ^~~~~~~~
In file included 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/ios_base.h:229:9: note: previous definition of 'class std::ios_base'
  229 |   class ios_base
      |         ^~~~~~~~
p1492.cpp:143:21: error: redefinition of 'class std::ios_base::failure'
  143 |     class ios_base::failure : public system_error {
      |                     ^~~~~~~
/usr/local/include/c++/12.1.0/bits/ios_base.h:256:34: note: previous definition of 'class std::ios_base::failure'
  256 |     class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error
      |                                  ^~~~~~~
p1492.cpp:154:46: error: 'error_code' does not name a type
  154 |    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
      |                                              ^~~~~~~~~~
p1492.cpp:154:63: error: 'io_errc' has not been declared
  154 |    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
      |                                                               ^~~~~~~
p1492.cpp:154:13: error: ISO C++ forbids declaration of 'failure' with no type [-fpermissive]
  154 |    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
      |             ^~~~~~~
p1492.cpp:154:4: error: 'explicit' outside class declaration
  154 |    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
      |    ^~~~~~~~
p1492.cpp:156:41: error: 'error_code' does not name a type
  156 | explicit failure(const char* msg, const error_code& ec = io_errc::stream);
      |                                         ^~~~~~~~~~
p1492.cpp:156:58: error: 'io_errc' has not been declared
  156 | explicit failure(const char* msg, const error_code& ec = io_errc::stream);
      |                                                          ^~~~~~~
p1492.cpp:156:10: error: ISO C++ forbids declaration of 'failure' with no type [-fpermissive]
  156 | explicit failure(const char* msg, const error_code& ec = io_errc::stream);
      |          ^~~~~~~
p1492.cpp:156:1: error: 'explicit' outside class declaration
  156 | explicit failure(const char* msg, const error_code& ec = io_errc::stream);
      | ^~~~~~~~
p1492.cpp:158:7: error: expected nested-name-specifier before 'fmtflags'
  158 | using fmtflags = T1;
      |       ^~~~~~~~
p1492.cpp:161:7: error: expected nested-name-specifier before 'iostate'
  161 | using iostate = T2;
      |       ^~~~~~~
p1492.cpp:164:7: error: expected nested-name-specifier before 'openmode'
  164 | using openmode = T3;
      |       ^~~~~~~~
p1492.cpp:166:7: error: expected nested-name-specifier before 'seekdir'
  166 | using seekdir = T4;
      |       ^~~~~~~
p1492.cpp:167:6: error: expected class-name before '(' token
  167 | ~Init();
      |      ^
p1492.cpp:170:1: error: 'fmtflags' does not name a type
  170 | fmtflags flags() const;
      | ^~~~~~~~
p1492.cpp:173:21: error: redefinition of 'class std::ios_base::Init'
  173 |     class ios_base::Init {
      |                     ^~~~
/usr/local/include/c++/12.1.0/bits/ios_base.h:635:11: note: previous definition of 'class std::ios_base::Init'
  635 |     class Init
      |           ^~~~
p1492.cpp:185:7: error: expected constructor, destructor, or type conversion before ';' token
  185 | Init();
      |       ^
p1492.cpp:188:1: error: 'fmtflags' does not name a type
  188 | fmtflags flags(fmtflags fmtfl);
      | ^~~~~~~~
p1492.cpp:190:1: error: 'fmtflags' does not name a type
  190 | fmtflags setf(fmtflags fmtfl);
      | ^~~~~~~~
p1492.cpp:193:1: error: 'fmtflags' does not name a type
  193 | fmtflags setf(fmtflags fmtfl, fmtflags mask);
      | ^~~~~~~~
p1492.cpp:195:6: error: variable or field 'unsetf' declared void
  195 | void unsetf(fmtflags mask);
      |      ^~~~~~
p1492.cpp:195:13: error: 'fmtflags' was not declared in this scope
  195 | void unsetf(fmtflags mask);
      |             ^~~~~~~~
p1492.cpp:200:20: error: non-member function 'std::streamsize width()' cannot have cv-qualifier
  200 | streamsize width() const;
      |                    ^~~~~
p1492.cpp:210:17: error: non-member function 'std::locale getloc()' cannot have cv-qualifier
  210 | locale getloc() const;
      |                 ^~~~~
p1492.cpp:217:6: error: expected constructor, destructor, or type conversion before '(' token
  217 | fputc(f, c);
      |      ^
p1492.cpp:219:3: error: 'str' does not name a type
  219 |   str.rdbuf()->sputc(c);
      |   ^~~
p1492.cpp:222:3: error: 'c' does not name a type
  222 |   c = str.rdbuf()->sbumpc();
      |   ^
p1492.cpp:225:3: error: 'str' does not name a type
  225 |   str.rdbuf()->sputbackc(c);
      |   ^~~
p1492.cpp:240:6: error: variable or field 'register_callback' declared void
  240 | void register_callback(event_callback fn, int idx);
      |      ^~~~~~~~~~~~~~~~~
p1492.cpp:240:24: error: 'event_callback' was not declared in this scope
  240 | void register_callback(event_callback fn, int idx);
      |                        ^~~~~~~~~~~~~~
p1492.cpp:240:43: error: expected primary-expression before 'int'
  240 | void register_callback(event_callback fn, int idx);
      |                                           ^~~
p1492.cpp:245:10: error: expected unqualified-id before ')' token
  245 | ios_base();
      |          ^
p1492.cpp:247:12: error: expected constructor, destructor, or type conversion before ';' token
  247 | ~ios_base();
      |            ^
p1492.cpp:251:34: error: redefinition of 'class std::fpos<_StateT>'
  251 |     template<class stateT> class fpos {
      |                                  ^~~~
In file included from /usr/local/include/c++/12.1.0/iosfwd:40,
                 from /usr/local/include/c++/12.1.0/ios:38:
/usr/local/include/c++/12.1.0/bits/postypes.h:82:11: note: previous definition of 'class std::fpos<_StateT'
   82 |     class fpos
      |           ^~~~
p1492.cpp:268:6: error: variable or field 'state' declared void
  268 | void state(stateT s);
      |      ^~~~~
p1492.cpp:268:12: error: 'stateT' was not declared in this scope; did you mean 'static'?
  268 | void state(stateT s);
      |            ^~~~~~
      |            static
p1492.cpp:273:4: error: 'P' does not name a type
  273 |    P p(o);
      |    ^
p1492.cpp:275:1: error: 'P' does not name a type
  275 | P p = o; state object.
      | ^
p1492.cpp:275:10: error: 'state' does not name a type; did you mean 'static'?
  275 | P p = o; state object.
      |          ^~~~~
      |          static
p1492.cpp:326:36: error: 'charT' was not declared in this scope; did you mean 'char'?
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |                                    ^~~~~
      |                                    char
p1492.cpp:326:43: error: 'traits' was not declared in this scope
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |                                           ^~~~~~
p1492.cpp:326:49: error: template argument 1 is invalid
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |                                                 ^
p1492.cpp:326:49: error: template argument 2 is invalid
p1492.cpp:326:10: error: ISO C++ forbids declaration of 'basic_ios' with no type [-fpermissive]
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |          ^~~~~~~~~
p1492.cpp:326:1: error: 'explicit' outside class declaration
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      | ^~~~~~~~
p1492.cpp:328:11: error: expected class-name before '(' token
  328 | ~basic_ios();
      |           ^
p1492.cpp:330:27: error: 'charT' was not declared in this scope; did you mean 'char'?
  330 | void init(basic_streambuf<charT, traits>* sb);
      |                           ^~~~~
      |                           char
p1492.cpp:330:34: error: 'traits' was not declared in this scope
  330 | void init(basic_streambuf<charT, traits>* sb);
      |                                  ^~~~~~
p1492.cpp:330:40: error: template argument 1 is invalid
  330 | void init(basic_streambuf<charT, traits>* sb);
      |                                        ^
p1492.cpp:330:40: error: template argument 2 is invalid
p1492.cpp:333:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  333 | basic_ostream<charT, traits>* tie() const;
      |               ^~~~~
      |               char
p1492.cpp:333:22: error: 'traits' was not declared in this scope
  333 | basic_ostream<charT, traits>* tie() const;
      |                      ^~~~~~
p1492.cpp:333:28: error: template argument 1 is invalid
  333 | basic_ostream<charT, traits>* tie() const;
      |                            ^
p1492.cpp:333:28: error: template argument 2 is invalid
p1492.cpp:333:37: error: non-member function 'int* tie()' cannot have cv-qualifier
  333 | basic_ostream<charT, traits>* tie() const;
      |                                     ^~~~~
p1492.cpp:334:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |               ^~~~~
      |               char
p1492.cpp:334:22: error: 'traits' was not declared in this scope
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                      ^~~~~~
p1492.cpp:334:28: error: template argument 1 is invalid
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                            ^
p1492.cpp:334:28: error: template argument 2 is invalid
p1492.cpp:334:49: error: 'charT' was not declared in this scope; did you mean 'char'?
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                                                 ^~~~~
      |                                                 char
p1492.cpp:334:56: error: 'traits' was not declared in this scope
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                                                        ^~~~~~
p1492.cpp:334:62: error: template argument 1 is invalid
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                                                              ^
p1492.cpp:334:62: error: template argument 2 is invalid
p1492.cpp:337:17: error: 'charT' was not declared in this scope; did you mean 'char'?
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                 ^~~~~
      |                 char
p1492.cpp:337:24: error: 'traits' was not declared in this scope
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                        ^~~~~~
p1492.cpp:337:30: error: template argument 1 is invalid
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                              ^
p1492.cpp:337:30: error: template argument 2 is invalid
p1492.cpp:337:41: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                                         ^~~~~
p1492.cpp:339:17: error: 'charT' was not declared in this scope; did you mean 'char'?
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                 ^~~~~
      |                 char
p1492.cpp:339:24: error: 'traits' was not declared in this scope
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                        ^~~~~~
p1492.cpp:339:30: error: template argument 1 is invalid
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                              ^
p1492.cpp:339:30: error: template argument 2 is invalid
p1492.cpp:339:55: error: 'charT' was not declared in this scope; did you mean 'char'?
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                                                       ^~~~~
      |                                                       char
p1492.cpp:339:62: error: 'traits' was not declared in this scope
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                                                              ^~~~~~
p1492.cpp:339:68: error: template argument 1 is invalid
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                                                                    ^
p1492.cpp:339:68: error: template argument 2 is invalid
p1492.cpp:345:13: error: 'char_type' was not declared in this scope
  345 | char narrow(char_type c, char dfault) const;
      |             ^~~~~~~~~
p1492.cpp:345:26: error: expected primary-expression before 'char'
  345 | char narrow(char_type c, char dfault) const;
      |                          ^~~~
p1492.cpp:345:37: error: expression list treated as compound expression in initializer [-fpermissive]
  345 | char narrow(char_type c, char dfault) const;
      |                                     ^
p1492.cpp:348:1: error: 'char_type' does not name a type
  348 | char_type fill() const;
      | ^~~~~~~~~
p1492.cpp:350:1: error: 'char_type' does not name a type
  350 | char_type fill(char_type fillch);
      | ^~~~~~~~~
p1492.cpp:352:1: error: reference to 'basic_ios' is ambiguous
  352 | basic_ios& copyfmt(const basic_ios& rhs);
      | ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ios'
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:326:10: note:                 'int basic_ios(int*)'
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |          ^~~~~~~~~
p1492.cpp:365:6: error: variable or field 'move' declared void
  365 | void move(basic_ios& rhs);
      |      ^~~~
p1492.cpp:365:11: error: reference to 'basic_ios' is ambiguous
  365 | void move(basic_ios& rhs);
      |           ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ios'
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:326:10: note:                 'int basic_ios(int*)'
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |          ^~~~~~~~~
p1492.cpp:365:22: error: 'rhs' was not declared in this scope
  365 | void move(basic_ios& rhs);
      |                      ^~~
p1492.cpp:366:6: error: variable or field 'move' declared void
  366 | void move(basic_ios&& rhs);
      |      ^~~~
p1492.cpp:366:11: error: reference to 'basic_ios' is ambiguous
  366 | void move(basic_ios&& rhs);
      |           ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ios'
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:326:10: note:                 'int basic_ios(int*)'
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |          ^~~~~~~~~
p1492.cpp:366:23: error: 'rhs' was not declared in this scope
  366 | void move(basic_ios&& rhs);
      |                       ^~~
p1492.cpp:369:9: error: variable or field 'swap' declared void
  369 |    void swap(basic_ios& rhs) noexcept;
      |         ^~~~
p1492.cpp:369:14: error: reference to 'basic_ios' is ambiguous
  369 |    void swap(basic_ios& rhs) noexcept;
      |              ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ios'
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:326:10: note:                 'int basic_ios(int*)'
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |          ^~~~~~~~~
p1492.cpp:369:25: error: 'rhs' was not declared in this scope
  369 |    void swap(basic_ios& rhs) noexcept;
      |                         ^~~
p1492.cpp:371:32: error: 'charT' was not declared in this scope; did you mean 'char'?
  371 | void set_rdbuf(basic_streambuf<charT, traits>* sb);
      |                                ^~~~~
      |                                char
p1492.cpp:371:39: error: 'traits' was not declared in this scope
  371 | void set_rdbuf(basic_streambuf<charT, traits>* sb);
      |                                       ^~~~~~
p1492.cpp:371:45: error: template argument 1 is invalid
  371 | void set_rdbuf(basic_streambuf<charT, traits>* sb);
      |                                             ^
p1492.cpp:371:45: error: template argument 2 is invalid
p1492.cpp:376:1: error: 'explicit' outside class declaration
  376 | explicit operator bool() const;
      | ^~~~~~~~
p1492.cpp:376:26: error: non-member function 'operator bool()' cannot have cv-qualifier
  376 | explicit operator bool() const;
      |                          ^~~~~
p1492.cpp:376:10: error: 'operator bool()' must be a non-static member function
  376 | explicit operator bool() const;
      |          ^~~~~~~~
p1492.cpp:378:18: error: non-member function 'bool operator!()' cannot have cv-qualifier
  378 | bool operator!() const;
      |                  ^~~~~
p1492.cpp:378:6: error: 'bool operator!()' must have an argument of class or enumerated type
  378 | bool operator!() const;
      |      ^~~~~~~~
p1492.cpp:380:1: error: 'iostate' does not name a type
  380 | iostate rdstate() const;
      | ^~~~~~~
p1492.cpp:382:6: error: variable or field 'clear' declared void
  382 | void clear(iostate state = goodbit);
      |      ^~~~~
p1492.cpp:382:12: error: 'iostate' was not declared in this scope
  382 | void clear(iostate state = goodbit);
      |            ^~~~~~~
p1492.cpp:385:6: error: variable or field 'setstate' declared void
  385 | void setstate(iostate state);
      |      ^~~~~~~~
p1492.cpp:385:15: error: 'iostate' was not declared in this scope
  385 | void setstate(iostate state);
      |               ^~~~~~~
p1492.cpp:388:12: error: non-member function 'bool eof()' cannot have cv-qualifier
  388 | bool eof() const;
      |            ^~~~~
p1492.cpp:390:13: error: non-member function 'bool fail()' cannot have cv-qualifier
  390 | bool fail() const;
      |             ^~~~~
p1492.cpp:392:12: error: non-member function 'bool bad()' cannot have cv-qualifier
  392 | bool bad() const;
      |            ^~~~~
p1492.cpp:394:1: error: 'iostate' does not name a type
  394 | iostate exceptions() const;
      | ^~~~~~~
p1492.cpp:396:6: error: variable or field 'exceptions' declared void
  396 | void exceptions(iostate except);
      |      ^~~~~~~~~~
p1492.cpp:396:17: error: 'iostate' was not declared in this scope
  396 | void exceptions(iostate except);
      |                 ^~~~~~~
p1492.cpp:462:1: error: 'xnext' does not name a type
  462 | xnext here);
      | ^~~~~
p1492.cpp:467:1: error: 'error_code' does not name a type
  467 | error_code make_error_code(io_errc e) noexcept;
      | ^~~~~~~~~~
p1492.cpp:469:7: error: 'error_category' does not name a type
  469 | const error_category& iostream_category() noexcept;
      |       ^~~~~~~~~~~~~~
p1492.cpp:470:1: error: expected declaration before '}' token
  470 | }
      | ^
p1492.cpp:213:13: warning: 'bool sync_with_stdio(bool)' declared 'static' but never defined [-Wunused-function]
  213 | static bool sync_with_stdio(bool sync = true);
      |             ^~~~~~~~~~~~~~~
p1492.cpp:228:12: warning: 'int xalloc()' declared 'static' but never defined [-Wunused-function]
  228 | static int xalloc();
      |            ^~~~~~

$ g++ p1492.cpp -std=2b -o p1492g -I. -Wall
p1492.cpp:17:19: error: 'implementation_defined' does not name a type
   17 | using streamoff = implementation_defined ;
      |                   ^~~~~~~~~~~~~~~~~~~~~~
p1492.cpp:18:20: error: 'implementation_defined' does not name a type
   18 | using streamsize = implementation_defined;
      |                    ^~~~~~~~~~~~~~~~~~~~~~
p1492.cpp:21:27: error: redefinition of default argument for 'class traits'
   21 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
In file included from /usr/local/include/c++/12.1.0/ios:38,
                 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 p1492.cpp:10:
/usr/local/include/c++/12.1.0/iosfwd:76:29: note: original definition appeared here
   76 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1492.cpp:45:1: error: 'stream' does not name a type; did you mean 'ostream'?
   45 | stream = 1 };
      | ^~~~~~
      | ostream
p1492.cpp:46:10: error: expected ')' before '&' token
   46 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:47:10: error: expected ')' before '&' token
   47 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:48:10: error: expected ')' before '&' token
   48 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:49:10: error: expected ')' before '&' token
   49 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:50:10: error: expected ')' before '&' token
   50 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:51:10: error: expected ')' before '&' token
   51 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:52:10: error: expected ')' before '&' token
   52 | (ios_base& str);
      | ~        ^
      |          )
p1492.cpp:53:19: error: explicit specialization of 'template<class _Tp> struct std::is_error_code_enum' outside its namespace must use a nested-name-specifier [-fpermissive]
   53 | template<> struct is_error_code_enum<io_errc> : public true_type { };
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1492.cpp:53:19: error: redefinition of 'struct std::is_error_code_enum<std::io_errc>'
In file included from /usr/local/include/c++/12.1.0/ios:42:
/usr/local/include/c++/12.1.0/bits/ios_base.h:206:22: note: previous definition of 'struct std::is_error_code_enum<std::io_errc>'
  206 |   template <> struct is_error_code_enum<io_errc> : public true_type { };
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1492.cpp:57:1: error: expected declaration before '}' token
   57 | }
      | ^
p1492.cpp:61:11: error: redefinition of 'class std::ios_base'
   61 |     class ios_base {
      |           ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/ios_base.h:229:9: note: previous definition of 'class std::ios_base'
  229 |   class ios_base
      |         ^~~~~~~~
p1492.cpp:143:21: error: redefinition of 'class std::ios_base::failure'
  143 |     class ios_base::failure : public system_error {
      |                     ^~~~~~~
/usr/local/include/c++/12.1.0/bits/ios_base.h:256:34: note: previous definition of 'class std::ios_base::failure'
  256 |     class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error
      |                                  ^~~~~~~
p1492.cpp:154:13: error: ISO C++ forbids declaration of 'failure' with no type [-fpermissive]
  154 |    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
      |             ^~~~~~~
p1492.cpp:154:4: error: 'explicit' outside class declaration
  154 |    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
      |    ^~~~~~~~
p1492.cpp:156:10: error: ISO C++ forbids declaration of 'failure' with no type [-fpermissive]
  156 | explicit failure(const char* msg, const error_code& ec = io_errc::stream);
      |          ^~~~~~~
p1492.cpp:156:1: error: 'explicit' outside class declaration
  156 | explicit failure(const char* msg, const error_code& ec = io_errc::stream);
      | ^~~~~~~~
p1492.cpp:158:18: error: 'T1' does not name a type
  158 | using fmtflags = T1;
      |                  ^~
p1492.cpp:161:17: error: 'T2' does not name a type
  161 | using iostate = T2;
      |                 ^~
p1492.cpp:164:18: error: 'T3' does not name a type
  164 | using openmode = T3;
      |                  ^~
p1492.cpp:166:17: error: 'T4' does not name a type
  166 | using seekdir = T4;
      |                 ^~
p1492.cpp:167:6: error: expected class-name before '(' token
  167 | ~Init();
      |      ^
p1492.cpp:170:1: error: 'fmtflags' does not name a type
  170 | fmtflags flags() const;
      | ^~~~~~~~
p1492.cpp:173:21: error: redefinition of 'class std::ios_base::Init'
  173 |     class ios_base::Init {
      |                     ^~~~
/usr/local/include/c++/12.1.0/bits/ios_base.h:635:11: note: previous definition of 'class std::ios_base::Init'
  635 |     class Init
      |           ^~~~
p1492.cpp:185:7: error: expected constructor, destructor, or type conversion before ';' token
  185 | Init();
      |       ^
p1492.cpp:188:1: error: 'fmtflags' does not name a type
  188 | fmtflags flags(fmtflags fmtfl);
      | ^~~~~~~~
p1492.cpp:190:1: error: 'fmtflags' does not name a type
  190 | fmtflags setf(fmtflags fmtfl);
      | ^~~~~~~~
p1492.cpp:193:1: error: 'fmtflags' does not name a type
  193 | fmtflags setf(fmtflags fmtfl, fmtflags mask);
      | ^~~~~~~~
p1492.cpp:195:6: error: variable or field 'unsetf' declared void
  195 | void unsetf(fmtflags mask);
      |      ^~~~~~
p1492.cpp:195:13: error: 'fmtflags' was not declared in this scope
  195 | void unsetf(fmtflags mask);
      |             ^~~~~~~~
p1492.cpp:200:20: error: non-member function 'std::streamsize width()' cannot have cv-qualifier
  200 | streamsize width() const;
      |                    ^~~~~
p1492.cpp:210:17: error: non-member function 'std::locale getloc()' cannot have cv-qualifier
  210 | locale getloc() const;
      |                 ^~~~~
p1492.cpp:217:6: error: expected constructor, destructor, or type conversion before '(' token
  217 | fputc(f, c);
      |      ^
p1492.cpp:219:3: error: 'str' does not name a type
  219 |   str.rdbuf()->sputc(c);
      |   ^~~
p1492.cpp:222:3: error: 'c' does not name a type
  222 |   c = str.rdbuf()->sbumpc();
      |   ^
p1492.cpp:225:3: error: 'str' does not name a type
  225 |   str.rdbuf()->sputbackc(c);
      |   ^~~
p1492.cpp:240:6: error: variable or field 'register_callback' declared void
  240 | void register_callback(event_callback fn, int idx);
      |      ^~~~~~~~~~~~~~~~~
p1492.cpp:240:24: error: 'event_callback' was not declared in this scope
  240 | void register_callback(event_callback fn, int idx);
      |                        ^~~~~~~~~~~~~~
p1492.cpp:240:43: error: expected primary-expression before 'int'
  240 | void register_callback(event_callback fn, int idx);
      |                                           ^~~
p1492.cpp:245:11: error: expected constructor, destructor, or type conversion before ';' token
  245 | ios_base();
      |           ^
p1492.cpp:247:12: error: expected constructor, destructor, or type conversion before ';' token
  247 | ~ios_base();
      |            ^
p1492.cpp:251:34: error: redefinition of 'class std::fpos<_StateT>'
  251 |     template<class stateT> class fpos {
      |                                  ^~~~
In file included from /usr/local/include/c++/12.1.0/iosfwd:40:
/usr/local/include/c++/12.1.0/bits/postypes.h:82:11: note: previous definition of 'class std::fpos<_StateT'
   82 |     class fpos
      |           ^~~~
p1492.cpp:268:6: error: variable or field 'state' declared void
  268 | void state(stateT s);
      |      ^~~~~
p1492.cpp:268:12: error: 'stateT' was not declared in this scope; did you mean 'static'?
  268 | void state(stateT s);
      |            ^~~~~~
      |            static
p1492.cpp:273:4: error: 'P' does not name a type
  273 |    P p(o);
      |    ^
p1492.cpp:275:1: error: 'P' does not name a type
  275 | P p = o; state object.
      | ^
p1492.cpp:275:10: error: 'state' does not name a type; did you mean 'static'?
  275 | P p = o; state object.
      |          ^~~~~
      |          static
p1492.cpp:326:36: error: 'charT' was not declared in this scope; did you mean 'char'?
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |                                    ^~~~~
      |                                    char
p1492.cpp:326:43: error: 'traits' was not declared in this scope
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |                                           ^~~~~~
p1492.cpp:326:49: error: template argument 1 is invalid
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |                                                 ^
p1492.cpp:326:49: error: template argument 2 is invalid
p1492.cpp:326:10: error: deduction guide for 'std::basic_ios<_CharT, _Traits>' must have trailing return type
  326 | explicit basic_ios(basic_streambuf<charT, traits>* sb);
      |          ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: 'template<class _CharT, class _Traits> class std::basic_ios' declared here
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:328:11: error: expected class-name before '(' token
  328 | ~basic_ios();
      |           ^
p1492.cpp:330:27: error: 'charT' was not declared in this scope; did you mean 'char'?
  330 | void init(basic_streambuf<charT, traits>* sb);
      |                           ^~~~~
      |                           char
p1492.cpp:330:34: error: 'traits' was not declared in this scope
  330 | void init(basic_streambuf<charT, traits>* sb);
      |                                  ^~~~~~
p1492.cpp:330:40: error: template argument 1 is invalid
  330 | void init(basic_streambuf<charT, traits>* sb);
      |                                        ^
p1492.cpp:330:40: error: template argument 2 is invalid
p1492.cpp:333:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  333 | basic_ostream<charT, traits>* tie() const;
      |               ^~~~~
      |               char
p1492.cpp:333:22: error: 'traits' was not declared in this scope
  333 | basic_ostream<charT, traits>* tie() const;
      |                      ^~~~~~
p1492.cpp:333:28: error: template argument 1 is invalid
  333 | basic_ostream<charT, traits>* tie() const;
      |                            ^
p1492.cpp:333:28: error: template argument 2 is invalid
p1492.cpp:333:37: error: non-member function 'int* tie()' cannot have cv-qualifier
  333 | basic_ostream<charT, traits>* tie() const;
      |                                     ^~~~~
p1492.cpp:334:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |               ^~~~~
      |               char
p1492.cpp:334:22: error: 'traits' was not declared in this scope
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                      ^~~~~~
p1492.cpp:334:28: error: template argument 1 is invalid
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                            ^
p1492.cpp:334:28: error: template argument 2 is invalid
p1492.cpp:334:49: error: 'charT' was not declared in this scope; did you mean 'char'?
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                                                 ^~~~~
      |                                                 char
p1492.cpp:334:56: error: 'traits' was not declared in this scope
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                                                        ^~~~~~
p1492.cpp:334:62: error: template argument 1 is invalid
  334 | basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
      |                                                              ^
p1492.cpp:334:62: error: template argument 2 is invalid
p1492.cpp:337:17: error: 'charT' was not declared in this scope; did you mean 'char'?
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                 ^~~~~
      |                 char
p1492.cpp:337:24: error: 'traits' was not declared in this scope
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                        ^~~~~~
p1492.cpp:337:30: error: template argument 1 is invalid
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                              ^
p1492.cpp:337:30: error: template argument 2 is invalid
p1492.cpp:337:41: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  337 | basic_streambuf<charT, traits>* rdbuf() const;
      |                                         ^~~~~
p1492.cpp:339:17: error: 'charT' was not declared in this scope; did you mean 'char'?
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                 ^~~~~
      |                 char
p1492.cpp:339:24: error: 'traits' was not declared in this scope
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                        ^~~~~~
p1492.cpp:339:30: error: template argument 1 is invalid
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                              ^
p1492.cpp:339:30: error: template argument 2 is invalid
p1492.cpp:339:55: error: 'charT' was not declared in this scope; did you mean 'char'?
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                                                       ^~~~~
      |                                                       char
p1492.cpp:339:62: error: 'traits' was not declared in this scope
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                                                              ^~~~~~
p1492.cpp:339:68: error: template argument 1 is invalid
  339 | basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
      |                                                                    ^
p1492.cpp:339:68: error: template argument 2 is invalid
p1492.cpp:345:13: error: 'char_type' was not declared in this scope
  345 | char narrow(char_type c, char dfault) const;
      |             ^~~~~~~~~
p1492.cpp:345:26: error: expected primary-expression before 'char'
  345 | char narrow(char_type c, char dfault) const;
      |                          ^~~~
p1492.cpp:345:37: error: expression list treated as compound expression in initializer [-fpermissive]
  345 | char narrow(char_type c, char dfault) const;
      |                                     ^
p1492.cpp:348:1: error: 'char_type' does not name a type
  348 | char_type fill() const;
      | ^~~~~~~~~
p1492.cpp:350:1: error: 'char_type' does not name a type
  350 | char_type fill(char_type fillch);
      | ^~~~~~~~~
p1492.cpp:352:20: error: template placeholder type 'const basic_ios<...auto...>' must be followed by a simple declarator-id
  352 | basic_ios& copyfmt(const basic_ios& rhs);
      |                    ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: 'template<class _CharT, class _Traits> class std::basic_ios' declared here
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:352:1: error: deduced class type 'basic_ios' in function return type
  352 | basic_ios& copyfmt(const basic_ios& rhs);
      | ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: 'template<class _CharT, class _Traits> class std::basic_ios' declared here
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:365:11: error: template placeholder type 'basic_ios<...auto...>' must be followed by a simple declarator-id
  365 | void move(basic_ios& rhs);
      |           ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: 'template<class _CharT, class _Traits> class std::basic_ios' declared here
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:366:11: error: template placeholder type 'basic_ios<...auto...>' must be followed by a simple declarator-id
  366 | void move(basic_ios&& rhs);
      |           ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: 'template<class _CharT, class _Traits> class std::basic_ios' declared here
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:369:14: error: template placeholder type 'basic_ios<...auto...>' must be followed by a simple declarator-id
  369 |    void swap(basic_ios& rhs) noexcept;
      |              ^~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:77:11: note: 'template<class _CharT, class _Traits> class std::basic_ios' declared here
   77 |     class basic_ios;
      |           ^~~~~~~~~
p1492.cpp:371:32: error: 'charT' was not declared in this scope; did you mean 'char'?
  371 | void set_rdbuf(basic_streambuf<charT, traits>* sb);
      |                                ^~~~~
      |                                char
p1492.cpp:371:39: error: 'traits' was not declared in this scope
  371 | void set_rdbuf(basic_streambuf<charT, traits>* sb);
      |                                       ^~~~~~
p1492.cpp:371:45: error: template argument 1 is invalid
  371 | void set_rdbuf(basic_streambuf<charT, traits>* sb);
      |                                             ^
p1492.cpp:371:45: error: template argument 2 is invalid
p1492.cpp:376:1: error: 'explicit' outside class declaration
  376 | explicit operator bool() const;
      | ^~~~~~~~
p1492.cpp:376:26: error: non-member function 'operator bool()' cannot have cv-qualifier
  376 | explicit operator bool() const;
      |                          ^~~~~
p1492.cpp:376:10: error: 'operator bool()' must be a non-static member function
  376 | explicit operator bool() const;
      |          ^~~~~~~~
p1492.cpp:378:18: error: non-member function 'bool operator!()' cannot have cv-qualifier
  378 | bool operator!() const;
      |                  ^~~~~
p1492.cpp:378:6: error: 'bool operator!()' must have an argument of class or enumerated type
  378 | bool operator!() const;
      |      ^~~~~~~~
p1492.cpp:380:1: error: 'iostate' does not name a type
  380 | iostate rdstate() const;
      | ^~~~~~~
p1492.cpp:382:6: error: variable or field 'clear' declared void
  382 | void clear(iostate state = goodbit);
      |      ^~~~~
p1492.cpp:382:12: error: 'iostate' was not declared in this scope
  382 | void clear(iostate state = goodbit);
      |            ^~~~~~~
p1492.cpp:385:6: error: variable or field 'setstate' declared void
  385 | void setstate(iostate state);
      |      ^~~~~~~~
p1492.cpp:385:15: error: 'iostate' was not declared in this scope
  385 | void setstate(iostate state);
      |               ^~~~~~~
p1492.cpp:388:12: error: non-member function 'bool eof()' cannot have cv-qualifier
  388 | bool eof() const;
      |            ^~~~~
p1492.cpp:390:13: error: non-member function 'bool fail()' cannot have cv-qualifier
  390 | bool fail() const;
      |             ^~~~~
p1492.cpp:392:12: error: non-member function 'bool bad()' cannot have cv-qualifier
  392 | bool bad() const;
      |            ^~~~~
p1492.cpp:394:1: error: 'iostate' does not name a type
  394 | iostate exceptions() const;
      | ^~~~~~~
p1492.cpp:396:6: error: variable or field 'exceptions' declared void
  396 | void exceptions(iostate except);
      |      ^~~~~~~~~~
p1492.cpp:396:17: error: 'iostate' was not declared in this scope
  396 | void exceptions(iostate except);
      |                 ^~~~~~~
p1492.cpp:462:1: error: 'xnext' does not name a type
  462 | xnext here);
      | ^~~~~
p1492.cpp:470:1: error: expected declaration before '}' token
  470 | }
      | ^
p1492.cpp:213:13: warning: 'bool sync_with_stdio(bool)' declared 'static' but never defined [-Wunused-function]
  213 | static bool sync_with_stdio(bool sync = true);
      |             ^~~~~~~~~~~~~~~
p1492.cpp:228:12: warning: 'int xalloc()' declared 'static' but never defined [-Wunused-function]
  228 | static int xalloc();
      |            ^~~~~~

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

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?