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.10 File-based streams [file.streams] C++N4910:2022 (693) p1560.cpp

Posted at

エンジニア夏休み企画

個人開発と読書感想文に焦点を当てたのは良い企画だと思った。

<この項は書きかけです。順次追記します。>

読書感想文

CコンパイラによるC言語規格の読書感想文として掲載しています。

コンパイル実験が、C++N4910に対する、G++とClang++による感想文だということご理解いただけると幸いです。

読書感想文は人間かAIだけが作るものとは限りません。
本(電子書籍を含む)を入力として、その内容に対する文字列を読書感想文として受け止めましょう。
元の文章をあり方、コンパイルできるように電子化しておくこと、コンパイラが解釈可能な断片の作り方など。

個人開発

【個人開発】 効率的な背景 <エンジニア夏休み企画>

Cコンパイラの試験を一人でもくもくとやっているのは個人開発の一つの姿です。

箱庭

箱庭もくもく会 #10 日時:2022/09/14(水) 17:30-19:30

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

20220826 以前

Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin

20220827 以降

Debian clang version 14.0.6-++20220622053050+f28c006a5895-1~exp1~20220622173135.152
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.10 File-based streams [file.streams] C++N4910:2022 (693) p1560.cpp

算譜(source code)

p1560.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.10 File-based streams [file.streams] C++N4910:2022 (693) p1560.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.10.1 Header <fstream> synopsis  [fstream.syn]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_filebuf;
template<class charT, class traits>
void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
using filebuf  = basic_filebuf<char>;
using wfilebuf = basic_filebuf<wchar_t>;
template<class charT, class traits = char_traits<charT>>
class basic_ifstream;
template<class charT, class traits>
void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
using ifstream  = basic_ifstream<char>;
using wifstream = basic_ifstream<wchar_t>;
template<class charT, class traits = char_traits<charT>>
class basic_ofstream;
template<class charT, class traits>
void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
using ofstream  = basic_ofstream<char>;
using wofstream = basic_ofstream<wchar_t>;
template<class charT, class traits = char_traits<charT>>
class basic_fstream;
template<class charT, class traits>
void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y);
using fstream  = basic_fstream<char>;
using wfstream = basic_fstream<wchar_t>;
}
//  The header <fstream> defines four class templates and eight types that associate stream buffers with files and assist reading and writing files.
//  [Note 1: The class template basic_filebuf treats a file as a source or sink of bytes. In an environment that uses a large character set, the file typically holds multibyte character sequences and the basic_filebuf object converts those multibyte sequences into wide character sequences. —end note]
//  In subclause 31.10, member functions taking arguments of const filesystem::path::value_type* are only provided on systems where filesystem::path::value_type (31.12.6) is not char.
// [Note 2: These functions enable class path support for systems with a wide native path character type, such as wchar_t.
// 31.10.2 Class template basic_filebuf  [filebuf]
// 31.10.2.1 General [filebuf.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_filebuf : public basic_streambuf<charT, traits> {
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.10.2.2, constructors/destructor basic_filebuf();
    basic_filebuf(const basic_filebuf&) = delete;
    basic_filebuf(basic_filebuf&& rhs);
    virtual ~basic_filebuf();
// 31.10.2.3, assignment and swap
    basic_filebuf& operator=(const basic_filebuf&) = delete;
    basic_filebuf& operator=(basic_filebuf&& rhs);
    void swap(basic_filebuf& rhs);
// 31.10.2.4, members
    bool is_open() const;
    basic_filebuf* open(const char* s, ios_base::openmode mode);
    basic_filebuf* open(const filesystem::path::value_type* s,
                        ios_base::openmode mode);
    basic_filebuf* open(const string& s,
                        ios_base::openmode mode);
    basic_filebuf* open(const filesystem::path& s,
                        ios_base::openmode mode);
    basic_filebuf* close();
protected:
// 31.10.2.5, overridden virtual functions streamsize showmanyc() override; int_type underflow() override; int_type uflow() override;
// wide systems only; see 31.10.1
// — If the file is not open for reading the input sequence cannot be read.
// — If the file is not open for writing the output sequence cannot be written.
// — A joint file position is maintained for both the input sequence and the output sequence.
// Effects: Initializes the base class with basic_streambuf<charT, traits>() (31.6.3.2). Postconditions: is_open() == false.
    int_type pbackfail(int_type c = traits::eof()) override;
    int_type overflow (int_type c = traits::eof()) override;
    basic_streambuf<charT, traits>* setbuf(char_type* s,
                                           streamsize n) override;
    pos_type seekoff(off_type off, ios_base::seekdir way,
                     ios_base::openmode which
                     = ios_base::in | ios_base::out) override;
    pos_type seekpos(pos_type sp,
                     ios_base::openmode which
                     = ios_base::in | ios_base::out) override;
    int      sync() override;
    void     imbue(const locale& loc) override;
};
}
//  The class basic_filebuf<charT, traits> associates both the input sequence and the output sequence with a file.
//  The restrictions on reading and writing a sequence controlled by an object of class basic_filebuf<charT, traits> are the same as for reading and writing with the C standard library FILEs.
//  In particular:
//  An instance of basic_filebuf behaves as described in 31.10.2 provided traits::pos_type is fpos<traits:: state_type>. Otherwise the behavior is undefined.
//  In order to support file I/O and multibyte/wide character conversion, conversions are performed using members of a facet, referred to as a_codecvt in following subclauses, obtained as if by
const codecvt<charT, char, typename traits::state_type>& a_codecvt =
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
// 31.10.2.2 Constructors [filebuf.cons]
basic_filebuf();
basic_filebuf(basic_filebuf&& rhs);
// Effects: It is implementation-defined whether the sequence pointers in *this (eback(), gptr(), egptr(), pbase(), pptr(), epptr()) obtain the values which rhs had. Whether they do or not, *this and rhs reference separate buffers (if any at all) after the construction. Additionally *this references the file which rhs did before the construction, and rhs references no file after the construction. The openmode, locale and any other state of rhs is also copied.
// Postconditions: Let rhs_p refer to the state of rhs just prior to this construction and let rhs_a refer to the state of rhs just after this construction.
// — is_open() == rhs_p.is_open()
// — rhs_a.is_open() == false
// — gptr() - eback() == rhs_p.gptr() - rhs_p.eback() — egptr() - eback() == rhs_p.egptr() - rhs_p.eback() — pptr() - pbase() == rhs_p.pptr() - rhs_p.pbase() — epptr() - pbase() == rhs_p.epptr() - rhs_p.pbase() — if (eback()) eback() != rhs_a.eback()
// — if (gptr()) gptr() != rhs_a.gptr()
// — if (egptr()) egptr() != rhs_a.egptr()
// — if (pbase()) pbase() != rhs_a.pbase() — if (pptr()) pptr() != rhs_a.pptr()
// — if (epptr()) epptr() != rhs_a.epptr()
virtual ~basic_filebuf();
// Effects: Calls close(). If an exception occurs during the destruction of the object, including the call to close(), the exception is caught but not rethrown (see 16.4.6.13).
// 31.10.2.3 Assignment and swap [filebuf.assign]
basic_filebuf& operator=(basic_filebuf&& rhs);
// Effects: Calls close() then move assigns from rhs. After the move assignment *this has the observable state it would have had if it had been move constructed from rhs (see 31.10.2.2).
// Returns: *this.
void swap(basic_filebuf& rhs);
// Effects: Exchanges the state of *this and rhs. template<class charT, class traits>
void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
// Effects: Equivalent to: x.swap(y).
// 31.10.2.4 Member functions [filebuf.members]
bool is_open() const;
// Returns: true if a previous call to open succeeded (returned a non-null value) and there has been no intervening call to close.
basic_filebuf* open(const char* s, ios_base::openmode mode);
basic_filebuf* open(const filesystem::path::value_type* s,
                    ios_base::openmode mode); // wide systems only; see 31.10.1 Preconditions: s points to a NTCTS (3.37).
// Effects: If is_open() != false, returns a null pointer. Otherwise, initializes the filebuf as required. It then opens the file to which s resolves, if possible, as if by a call to fopen with the second argument determined from mode & ~ios_base::ate as indicated in Table 124. If mode is not some combination of flags shown in the table then the open fails.
// If the open operation succeeds and ios_base::ate is set in mode, positions the file to the end (as if by calling fseek(file, 0, SEEK_END), where file is the pointer returned by calling fopen).310
// If the repositioning operation fails, calls close() and returns a null pointer to indicate failure. Returns: this if successful, a null pointer otherwise.
basic_filebuf* open(const string& s, ios_base::openmode mode);
basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
// Returns: open(s.c_str(), mode); basic_filebuf* close();
// Effects: If is_open() == false, returns a null pointer. If a put area exists, calls overflow(traits:: eof()) to flush characters. If the last virtual member function called on *this (between underflow, overflow, seekoff, and seekpos) was overflow then calls a_codecvt.unshift (possibly several times) to determine a termination sequence, inserts those characters and calls overflow(traits:: eof()) again. Finally, regardless of whether any of the preceding calls fails or throws an exception, the function closes the file (as if by calling fclose(file)). If any of the calls made by the function, including fclose, fails, close fails by returning a null pointer. If one of these calls throws an exception, the exception is caught and rethrown after closing the file.
//  310) The macro SEEK_END is defined, and the function signatures fopen(const char*, const char*) and fseek(FILE*, long, int) are declared, in <cstdio>
// Postconditions: is_open() == false.
// Returns: this on success, a null pointer otherwise.
// 31.10.2.5 Overridden virtual functions [filebuf.virtuals]
streamsize showmanyc() override;
// Effects: Behaves according to the description of basic_streambuf<charT, traits>::uflow(), with the specialization that a sequence of characters is read from the input with the same method as used by underflow.
// Table 124: File open modes[tab:filebuf.open.modes]
// ios_base flag combination stdio equivalent binary in out trunc app
// Effects: Behaves the same as basic_streambuf::showmanyc() (31.6.3.5).
// Remarks: An implementation may provide an overriding definition for this function signature if it can determine whether more characters can be read from the input sequence.
int_type underflow() override;
// Effects: Behaves according to the description of basic_streambuf<charT, traits>::underflow(), with the specialization that a sequence of characters is read from the input sequence as if by reading from the associated file into an internal buffer (extern_buf) and then as if by doing:
char   extern_buf[XSIZE];
char*  extern_end;
charT  intern_buf[ISIZE];
charT* intern_end;
codecvt_base::result r =
    a_codecvt.in(state, extern_buf, extern_buf+XSIZE, extern_end,
                 intern_buf, intern_buf+ISIZE, intern_end);
// This shall be done in such a way that the class can recover the position (fpos_t) corresponding to each character between intern_buf and intern_end. If the value of r indicates that a_codecvt.in() ran out of space in intern_buf, retry with a larger intern_buf.
int_type uflow() override;
int_type pbackfail(int_type c = traits::eof()) override;
// Effects: Puts back the character designated by c to the input sequence, if possible, in one of three ways:
// — If traits::eq_int_type(c, traits::eof()) returns false and if the function makes a putback position available and if traits::eq(to_char_type(c), gptr()[-1]) returns true, decrements the next pointer for the input sequence, gptr().
// Returns: c.
// — If traits::eq_int_type(c, traits::eof()) returns false and if the function makes a putback position available and if the function is permitted to assign to the putback position, decrements the next pointer for the input sequence, and stores c there.
// Returns: c.
// — If traits::eq_int_type(c, traits::eof()) returns true, and if either the input sequence has a putback position available or the function makes a putback position available, decrements the next pointer for the input sequence, gptr().
// Returns: traits::not_eof(c).
// Returns: As specified above, or traits::eof() to indicate failure.
// Remarks: If is_open() == false, the function always fails.
// The function does not put back a character directly to the input sequence.
// If the function can succeed in more than one of these ways, it is unspecified which way is chosen. The function can alter the number of putback positions available as a result of any call.
int_type overflow(int_type c = traits::eof()) override;
// Effects: Behaves according to the description of basic_streambuf<charT, traits>::overflow(c), except that the behavior of “consuming characters” is performed by first converting as if by:
charT* b = pbase();
charT* p = pptr();
charT* end;
char   xbuf[XSIZE];
char*  xbuf_end;
codecvt_base::result r =
    a_codecvt.out(state, b, p, end, xbuf, xbuf+XSIZE, xbuf_end);
// and then
// — If r == codecvt_base::error then fail.
// — If r == codecvt_base::noconv then output characters from b up to (and not including) p.
// — If r == codecvt_base::partial then output to the file characters from xbuf up to xbuf_end, and repeat using characters from end to p. If output fails, fail (without repeating).
// — Otherwise output from xbuf to xbuf_end, and fail if output fails. At this point if b != p and b == end (xbuf isn’t large enough) then increase XSIZE and repeat from the beginning.
// Returns: traits::not_eof(c) to indicate success, and traits::eof() to indicate failure. If is_- open() == false, the function always fails.
basic_streambuf* setbuf(char_type* s, streamsize n) override;
// Effects: If setbuf(0, 0) is called on a stream before any I/O has occurred on that stream, the stream becomes unbuffered. Otherwise the results are implementation-defined. “Unbuffered” means that pbase() and pptr() always return null and output to the file should appear as soon as possible.
pos_type seekoff(off_type off, ios_base::seekdir way,
                 ios_base::openmode which
                 = ios_base::in | ios_base::out) override;
// Effects: Let width denote a_codecvt.encoding(). If is_open() == false, or off != 0 && width <= 0, then the positioning operation fails. Otherwise, if way != basic_ios::cur or off != 0, and if the last operation was output, then update the output sequence and write any unshift sequence. Next, seek to the new position: if width > 0, call fseek(file, width * off, whence), otherwise call fseek(file, 0, whence).
// Returns: A newly constructed pos_type object that stores the resultant stream position, if possible. If the positioning operation fails, or if the object cannot represent the resultant stream position, returns pos_type(off_type(-1)).
// Remarks: “The last operation was output” means either the last virtual operation was overflow or the put buffer is non-empty. “Write any unshift sequence” means, if width if less than zero then call a_codecvt.unshift(state, xbuf, xbuf+XSIZE, xbuf_end) and output the resulting unshift sequence. The function determines one of three values for the argument whence, of type int, as indicated in Table 125.
// Table 125: seekoff effects [tab:filebuf.seekoff]
    = ios_base::in | ios_base::out) override;
// Alters the file position, if possible, to correspond to the position stored in sp (as described below). Altering the file position performs as follows:
//  if (om & ios_base::out) != 0, then update the output sequence and write any unshift sequence; 2. set the file position to sp as if by a call to fsetpos;
//  if (om & ios_base::in) != 0, then update the input sequence; where om is the open mode passed to the last call to open(). The operation fails if is_open() returns false.
// If sp is an invalid stream position, or if the function positions neither sequence, the positioning operation fails. If sp has not been obtained by a previous successful call to one of the positioning functions (seekoff or seekpos) on the same file the effects are undefined. Returns: sp on success. Otherwise returns pos_type(off_type(-1)). way Value stdio Equivalent  basic_ios::beg SEEK_SET basic_ios::cur SEEK_CUR basic_ios::end SEEK_END  pos_type seekpos(pos_type sp,       ios_base::openmode which
int sync() override;
// Effects: If a put area exists, calls filebuf::overflow to write the characters to the file, then flushes the file as if by calling fflush(file). If a get area exists, the effect is implementation-defined.
void imbue(const locale& loc) override;
// Preconditions: If the file is not positioned at its beginning and the encoding of the current locale as determined by a_codecvt.encoding() is state-dependent (30.4.2.5.3) then that facet is the same as the corresponding facet of loc.
// Effects: Causes characters inserted or extracted after this call to be converted according to loc until another call of imbue.
// Remarks: This may require reconversion of previously converted characters. This in turn may require the implementation to be able to reconstruct the original contents of the file.
// 31.10.3 Class template basic_ifstream [ifstream]
// 31.10.3.1 General [ifstream.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_ifstream : public basic_istream<charT, traits> {
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;
// — sb, the filebuf object.
// 31.10.3.2 Constructors [ifstream.cons]
    basic_ifstream();
// 31.10.3.2, constructors basic_ifstream();
    explicit basic_ifstream(const char* s,
                            ios_base::openmode mode = ios_base::in);
    explicit basic_ifstream(const filesystem::path::value_type* s,
                            ios_base::openmode mode = ios_base::in);// wide systems only; see 31.10.1 explicit basic_ifstream(const string& s,
    ios_base::openmode mode = ios_base::in);
    template<class T>
    explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
    basic_ifstream(const basic_ifstream&) = delete;
    basic_ifstream(basic_ifstream&& rhs);
    basic_ifstream& operator=(const basic_ifstream&) = delete;
    basic_ifstream& operator=(basic_ifstream&& rhs);
// 31.10.3.3, swap
    void swap(basic_ifstream& rhs);
// 31.10.3.4, members
    basic_filebuf<charT, traits>* rdbuf() const;
    bool is_open() const;
    void open(const char* s, ios_base::openmode mode = ios_base::in);
    void open(const filesystem::path::value_type* s,
              ios_base::openmode mode = ios_base::in); // wide systems only; see 31.10.1 void open(const string& s, ios_base::openmode mode = ios_base::in);
    void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
    void close();
private:
    basic_filebuf<charT, traits> sb; // exposition only
};
}
//  The class basic_ifstream<charT, traits> supports reading from named files. It uses a basic_filebuf< charT, traits> object to control the associated sequence. For the sake of exposition, the maintained data is presented here as:
// Effects: Initializes the base class with basic_istream<charT, traits>(addressof(sb)) (31.7.4.2.2) and sb with basic_filebuf<charT, traits>() (31.10.2.2).
explicit basic_ifstream(const char* s,
         ios_base::openmode mode = ios_base::in);
explicit basic_ifstream(const filesystem::path::value_type* s,
                        ios_base::openmode mode = ios_base::in);
// wide systems only; see 31.10.1
// Effects: Initializes the base class with basic_istream<charT, traits>(addressof(sb)) (31.7.4.2.2) and sb with basic_filebuf<charT, traits>() (31.10.2.2), then calls rdbuf()->open(s, mode | ios_base::in). If that function returns a null pointer, calls setstate(failbit).
explicit basic_ifstream(const string& s,
                        ios_base::openmode mode = ios_base::in);
// Effects: Equivalent to: basic_ifstream(s.c_str(), mode). template<class T>
explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
// Constraints: is_same_v<T, filesystem::path> is true. Effects: Equivalent to: basic_ifstream(s.c_str(), mode).
basic_ifstream(basic_ifstream&& rhs);
// Effects: Move constructs the base class, and the contained basic_filebuf. Then calls basic_- istream<charT, traits>::set_rdbuf(addressof(sb)) to install the contained basic_filebuf.
// 31.10.3.3 Swap [ifstream.swap]
void swap(basic_ifstream& rhs);
// Effects: Exchanges the state of *this and rhs by calling basic_istream<charT, traits>::swap(rhs) and sb.swap(rhs.sb).
template<class charT, class traits>
void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
// Effects: Equivalent to: x.swap(y).
// 31.10.3.4 Member functions [ifstream.members]
basic_filebuf<charT, traits>* rdbuf() const;
// Returns: const_cast<basic_filebuf<charT, traits>*>(addressof(sb)). bool is_open() const;
// Returns: rdbuf()->is_open().
void open(const char* s, ios_base::openmode mode = ios_base::in);
void open(const filesystem::path::value_type* s,
          ios_base::openmode mode = ios_base::in); // wide systems only; see 31.10.1
// Effects: Calls rdbuf()->open(s, mode | ios_base::in). If that function does not return a null pointer calls clear(), otherwise calls setstate(failbit) (which may throw ios_base::failure)(31.5.4.4).
void open(const string& s, ios_base::openmode mode = ios_base::in);
void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
// Effects: Calls open(s.c_str(), mode). void close();
// Effects: Calls rdbuf()->close() and, if that function returns a null pointer, calls setstate(failbit) (which may throw ios_base::failure) (31.5.4.4).
// 31.10.4 Class template basic_ofstream  [ofstream]
// 31.10.4.1 General [ofstream.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_ofstream : public basic_ostream<charT, traits> {
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.10.4.2, constructors basic_ofstream();
    explicit basic_ofstream(const char* s,
                            ios_base::openmode mode = ios_base::out);
    explicit basic_ofstream(const filesystem::path::value_type* s, // wide systems only; see 31.10.1
                            ios_base::openmode mode = ios_base::out);
    explicit basic_ofstream(const string& s,
                            ios_base::openmode mode = ios_base::out);
    template<class T>
    explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
    basic_ofstream(const basic_ofstream&) = delete;
    basic_ofstream(basic_ofstream&& rhs);
// — sb, the filebuf object.
// 31.10.4.2 Constructors [ofstream.cons]
    basic_ofstream();
    basic_ofstream& operator=(const basic_ofstream&) = delete;
    basic_ofstream& operator=(basic_ofstream&& rhs);
// 31.10.4.3, swap
    void swap(basic_ofstream& rhs);
// 31.10.4.4, members
    basic_filebuf<charT, traits>* rdbuf() const;
    bool is_open() const;
    void open(const char* s, ios_base::openmode mode = ios_base::out);
    void open(const filesystem::path::value_type* s,
              ios_base::openmode mode = ios_base::out); // wide systems only; see 31.10.1 void open(const string& s, ios_base::openmode mode = ios_base::out);
    void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
    void close();
private:
    basic_filebuf<charT, traits> sb; // exposition only
};
}
//  The class basic_ofstream<charT, traits> supports writing to named files. It uses a basic_filebuf< charT, traits> object to control the associated sequence. For the sake of exposition, the maintained data is presented here as:
// Effects: Initializes the base class with basic_ostream<charT, traits>(addressof(sb)) (31.7.5.2.2) and sb with basic_filebuf<charT, traits>() (31.10.2.2).
explicit basic_ofstream(const char* s,
         ios_base::openmode mode = ios_base::out);
explicit basic_ofstream(const filesystem::path::value_type* s,
                        ios_base::openmode mode = ios_base::out); // wide systems only; see 31.10.1
// Effects: Initializes the base class with basic_ostream<charT, traits>(addressof(sb)) (31.7.5.2.2) and sb with basic_filebuf<charT, traits>() (31.10.2.2), then calls rdbuf()->open(s, mode | ios_base::out). If that function returns a null pointer, calls setstate(failbit).
explicit basic_ofstream(const string& s,
                        ios_base::openmode mode = ios_base::out);
// Effects: Equivalent to: basic_ofstream(s.c_str(), mode). template<class T>
explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
// Constraints: is_same_v<T, filesystem::path> is true. Effects: Equivalent to: basic_ofstream(s.c_str(), mode).
basic_ofstream(basic_ofstream&& rhs);
// Effects: Move constructs the base class, and the contained basic_filebuf. Then calls basic_- ostream<charT, traits>::set_rdbuf(addressof(sb)) to install the contained basic_filebuf.
// 31.10.4.3 Swap [ofstream.swap]
void swap(basic_ofstream& rhs);
// Effects: Exchanges the state of *this and rhs by calling basic_ostream<charT, traits>::swap(rhs) and sb.swap(rhs.sb).
template<class charT, class traits>
void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
// Effects: Equivalent to: x.swap(y).
// 31.10.4.4 Member functions [ofstream.members]
basic_filebuf<charT, traits>* rdbuf() const;
// Returns: const_cast<basic_filebuf<charT, traits>*>(addressof(sb)). bool is_open() const;
// Returns: rdbuf()->is_open().
void open(const char* s, ios_base::openmode mode = ios_base::out);
void open(const filesystem::path::value_type* s,
          ios_base::openmode mode = ios_base::out); // wide systems only; see 31.10.1
// Effects: Calls rdbuf()->open(s, mode | ios_base::out). If that function does not return a null pointer calls clear(), otherwise calls setstate(failbit) (which may throw ios_base::failure) (31.5.4.4).
void close();
// Effects: Calls rdbuf()->close() and, if that function fails (returns a null pointer), calls setstate( failbit) (which may throw ios_base::failure) (31.5.4.4).
void open(const string& s, ios_base::openmode mode = ios_base::out);
void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
// Effects: Calls open(s.c_str(), mode).
// 31.10.5 Class template basic_fstream [fstream]
// 31.10.5.1 General [fstream.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_fstream : public basic_iostream<charT, traits> {
public:
    using char_type = charT;
    using int_type = traits::int_type;
    using pos_type = traits::pos_type;
    using off_type = traits::off_type;
    using traits_type = traits;
// 31.10.5.2, constructors basic_fstream(); explicit basic_fstream(
    const char* s,
          ios_base::openmode mode = ios_base::in | ios_base::out);
    explicit basic_fstream(
        const filesystem::path::value_type* s,
        ios_base::openmode mode = ios_base::in|ios_base::out);
    explicit basic_fstream(
        const string& s,
        ios_base::openmode mode = ios_base::in | ios_base::out);
    template<class T>
// wide systems only; see 31.10.1
    explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
    basic_fstream(const basic_fstream&) = delete;
    basic_fstream(basic_fstream&& rhs);
    basic_fstream& operator=(const basic_fstream&) = delete;
    basic_fstream& operator=(basic_fstream&& rhs);
// 31.10.5.3, swap
    void swap(basic_fstream& rhs);
// — sb, the basic_filebuf object.
// 31.10.5.2 Constructors [fstream.cons]
    basic_fstream();
// 31.10.5.4, members
    basic_filebuf<charT, traits>* rdbuf() const;
    bool is_open() const;
    void open(
        const char* s,
        ios_base::openmode mode = ios_base::in | ios_base::out);
    void open(
        const filesystem::path::value_type* s,
        ios_base::openmode mode = ios_base::in|ios_base::out);
    void open(
        const string& s,
        ios_base::openmode mode = ios_base::in | ios_base::out);
    void open(
        const filesystem::path& s,
        ios_base::openmode mode = ios_base::in | ios_base::out);
    void close();
private:
    basic_filebuf<charT, traits> sb; // exposition only
};
}
// wide systems only; see 31.10.1
//  The class template basic_fstream<charT, traits> supports reading and writing from named files. It uses a basic_filebuf<charT, traits> object to control the associated sequences. For the sake of exposition, the maintained data is presented here as:
// Effects: Initializes the base class with basic_iostream<charT, traits>(addressof(sb)) (31.7.4.7.2) and sb with basic_filebuf<charT, traits>().
explicit basic_fstream(
    const char* s,
          ios_base::openmode mode = ios_base::in | ios_base::out);
explicit basic_fstream(
    const filesystem::path::value_type* s,
    ios_base::openmode mode = ios_base::in | ios_base::out);
// wide systems only; see 31.10.1
// Effects: Initializes the base class with basic_iostream<charT, traits>(addressof(sb)) (31.7.4.7.2) and sb with basic_filebuf<charT, traits>(). Then calls rdbuf()->open(s, mode). If that func- tion returns a null pointer, calls setstate(failbit).
explicit basic_fstream(
    const string& s,
    ios_base::openmode mode = ios_base::in | ios_base::out);
// Effects: Equivalent to: basic_fstream(s.c_str(), mode). template<class T>
explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
// Constraints: is_same_v<T, filesystem::path> is true. Effects: Equivalent to: basic_fstream(s.c_str(), mode).
basic_fstream(basic_fstream&& rhs);
// Effects: Move constructs the base class, and the contained basic_filebuf. Then calls basic_- istream<charT, traits>::set_rdbuf(addressof(sb)) to install the contained basic_filebuf.
// 31.10.5.3 Swap [fstream.swap]
void swap(basic_fstream& rhs);
// Effects: Exchanges the state of *this and rhs by calling basic_iostream<charT,traits>::swap(rhs) and sb.swap(rhs.sb).
template<class charT, class traits>
void swap(basic_fstream<charT, traits>& x,
          basic_fstream<charT, traits>& y);
// Effects: Equivalent to: x.swap(y).
// 31.10.5.4 Member functions [fstream.members]
basic_filebuf<charT, traits>* rdbuf() const;
// Returns: const_cast<basic_filebuf<charT, traits>*>(addressof(sb)). bool is_open() const;
// Returns: rdbuf()->is_open().
void open(
    const char* s,
    ios_base::openmode mode = ios_base::in | ios_base::out);
void open(
    const filesystem::path::value_type* s,
    ios_base::openmode mode = ios_base::in | ios_base::out); // wide systems only; see 31.10.1
// Effects: Calls rdbuf()->open(s, mode). If that function does not return a null pointer calls clear(), otherwise calls setstate(failbit) (which may throw ios_base::failure) (31.5.4.4).
void open(
    const string& s,
    ios_base::openmode mode = ios_base::in | ios_base::out);
void open(
    const filesystem::path& s,
    ios_base::openmode mode = ios_base::in | ios_base::out);
// Effects: Calls open(s.c_str(), mode). void close();
// Effects: Calls rdbuf()->close() and, if that function returns a null pointer, calls setstate(failbit) (which may throw ios_base::failure) (31.5.4.4).
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

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

bash
$ clang++ p1560.cpp -std=03 -o p1560l -I. -Wall
In file included from p1560.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 \
 ^
p1560.cpp:16:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1560.cpp:16: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:112:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:20:22: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using filebuf  = basic_filebuf<char>;
                     ^
p1560.cpp:21:22: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using wfilebuf = basic_filebuf<wchar_t>;
                     ^
p1560.cpp:22:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1560.cpp:22: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:115:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:26:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using ifstream  = basic_ifstream<char>;
                      ^
p1560.cpp:27:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using wifstream = basic_ifstream<wchar_t>;
                      ^
p1560.cpp:28:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1560.cpp:28: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:118:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:32:26: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
       using ofstream  = basic_ofstream<char>;
                         ^
p1560.cpp:33:26: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
       using wofstream = basic_ofstream<wchar_t>;
                         ^
p1560.cpp:34:62: error: a space is required between consecutive right angle brackets (use '> >')
       template<class charT, class traits = char_traits<charT>>
                                                             ^~
                                                             > >
p1560.cpp:34:45: 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:121:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:38:25: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
       using fstream  = basic_fstream<char>;
                        ^
p1560.cpp:39:25: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
       using wfstream = basic_fstream<wchar_t>;
                        ^
p1560.cpp:48:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1560.cpp:48:42: error: template parameter redefines default argument
    template<class charT, class traits = char_traits<charT>>
                                         ^
p1560.cpp:16:42: note: previous default template argument defined here
    template<class charT, class traits = char_traits<charT>>
                                         ^
p1560.cpp:51:19: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using char_type = charT;
                  ^
p1560.cpp:52:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using int_type = typename traits::int_type;
                 ^
p1560.cpp:53:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using pos_type = typename traits::pos_type;
                 ^
p1560.cpp:54:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using off_type = typename traits::off_type;
                 ^
p1560.cpp:55:21: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using traits_type = traits;
                    ^
p1560.cpp:57:39: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
basic_filebuf(const basic_filebuf&) = delete; basic_filebuf(basic_filebuf&& rhs);
                                      ^
p1560.cpp:57:74: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
basic_filebuf(const basic_filebuf&) = delete; basic_filebuf(basic_filebuf&& rhs);
                                                                         ^
p1560.cpp:60:50: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
basic_filebuf& operator=(const basic_filebuf&) = delete; basic_filebuf& operator=(basic_filebuf&& rhs);
                                                 ^
p1560.cpp:60:96: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
basic_filebuf& operator=(const basic_filebuf&) = delete; basic_filebuf& operator=(basic_filebuf&& rhs);
                                                                                               ^
p1560.cpp:64:88: error: use of undeclared identifier 'filesystem'
basic_filebuf* open(const char* s, ios_base::openmode mode); basic_filebuf* open(const filesystem::path::value_type* s,
                                                                                       ^
p1560.cpp:68:29: error: use of undeclared identifier 'filesystem'
  basic_filebuf* open(const filesystem::path& s,
                            ^
p1560.cpp:78:57: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
         int_type pbackfail(int_type c = traits::eof()) override;
                                                        ^
p1560.cpp:79:57: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
         int_type overflow (int_type c = traits::eof()) override;
                                                        ^
p1560.cpp:81:63: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                                                streamsize n) override;
                                                              ^
p1560.cpp:84:60: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                           = ios_base::in | ios_base::out) override;
                                                           ^
p1560.cpp:87:60: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                           = ios_base::in | ios_base::out) override;
                                                           ^
p1560.cpp:88:26: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
         int      sync() override;
                         ^
p1560.cpp:89:44: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
         void     imbue(const locale& loc) override;
                                           ^
p1560.cpp:97:17: error: use of undeclared identifier 'charT'; did you mean 'char'?
  const codecvt<charT, char, typename traits::state_type>& a_codecvt =
                ^~~~~
                char
p1560.cpp:97:39: error: use of undeclared identifier 'traits'
  const codecvt<charT, char, typename traits::state_type>& a_codecvt =
                                      ^
p1560.cpp:98:23: error: use of undeclared identifier 'charT'; did you mean 'char'?
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                      ^~~~~
                      char
p1560.cpp:98:45: error: use of undeclared identifier 'traits'
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                                            ^
p1560.cpp:98:75: error: expected '>'
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                                                                          ^
p1560.cpp:98:22: note: to match this '<'
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                     ^
p1560.cpp:98:75: error: expected a type
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                                                                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
24 warnings and 20 errors generated.
$ clang++ p1560.cpp -std=2b -o p1560l -I. -Wall
p1560.cpp:16: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:112:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:22: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:115:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:28: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:118:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:34:45: 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:121:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1560.cpp:48:42: error: template parameter redefines default argument
    template<class charT, class traits = char_traits<charT>>
                                         ^
p1560.cpp:16:42: note: previous default template argument defined here
    template<class charT, class traits = char_traits<charT>>
                                         ^
p1560.cpp:64:88: error: use of undeclared identifier 'filesystem'
basic_filebuf* open(const char* s, ios_base::openmode mode); basic_filebuf* open(const filesystem::path::value_type* s,
                                                                                       ^
p1560.cpp:68:29: error: use of undeclared identifier 'filesystem'
  basic_filebuf* open(const filesystem::path& s,
                            ^
p1560.cpp:97:17: error: use of undeclared identifier 'charT'; did you mean 'char'?
  const codecvt<charT, char, typename traits::state_type>& a_codecvt =
                ^~~~~
                char
p1560.cpp:97:39: error: use of undeclared identifier 'traits'
  const codecvt<charT, char, typename traits::state_type>& a_codecvt =
                                      ^
p1560.cpp:98:23: error: use of undeclared identifier 'charT'; did you mean 'char'?
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                      ^~~~~
                      char
p1560.cpp:98:45: error: use of undeclared identifier 'traits'
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                                            ^
p1560.cpp:98:66: error: use of undeclared identifier 'getloc'
    use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
                                                                 ^
p1560.cpp:100:1: error: deduction guide must be declared in the same scope as template 'std::basic_filebuf'
basic_filebuf();
^
p1560.cpp:49:11: note: template is declared here
    class basic_filebuf : public basic_streambuf<charT, traits> {
          ^
p1560.cpp:100:1: error: deduction guide declaration without trailing return type
basic_filebuf();
^
p1560.cpp:101:15: error: use of class template 'basic_filebuf' requires template arguments; argument deduction not allowed in function prototype
basic_filebuf(basic_filebuf&& rhs);
              ^~~~~~~~~~~~~
p1560.cpp:49:11: note: template is declared here
    class basic_filebuf : public basic_streambuf<charT, traits> {
          ^
p1560.cpp:101:1: error: deduction guide must be declared in the same scope as template 'std::basic_filebuf'
basic_filebuf(basic_filebuf&& rhs);
^
p1560.cpp:49:11: note: template is declared here
    class basic_filebuf : public basic_streambuf<charT, traits> {
          ^
p1560.cpp:101:1: error: deduction guide declaration without trailing return type
basic_filebuf(basic_filebuf&& rhs);
^
p1560.cpp:111:10: error: identifier 'basic_filebuf' after '~' in destructor name does not name a type
virtual ~basic_filebuf();
         ^
p1560.cpp:49:11: note: non-type declaration found by destructor name lookup
    class basic_filebuf : public basic_streambuf<charT, traits> {
          ^
p1560.cpp:114:26: error: use of class template 'basic_filebuf' requires template arguments; argument deduction not allowed in function prototype
basic_filebuf& operator=(basic_filebuf&& rhs);
                         ^~~~~~~~~~~~~
p1560.cpp:49:11: note: template is declared here
    class basic_filebuf : public basic_streambuf<charT, traits> {
          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1560.cpp -std=03 -o p1560g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1560.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 \
      |  ^~~~~
p1560.cpp:16:59: error: spurious '>>', use '>' to terminate a template argument list
   16 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1560.cpp:17:13: error: template argument required for 'class basic_filebuf'
   17 |       class basic_filebuf;
      |             ^~~~~~~~~~~~~
p1560.cpp:16:42: error: two or more data types in declaration of 'type name'
   16 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1560.cpp:17:26: error: expected '>' before ';' token
   17 |       class basic_filebuf;
      |                          ^
p1560.cpp:17:26: error: expected unqualified-id before ';' token
p1560.cpp:20:11: error: expected nested-name-specifier before 'filebuf'
   20 |     using filebuf  = basic_filebuf<char>;
      |           ^~~~~~~
p1560.cpp:21:11: error: expected nested-name-specifier before 'wfilebuf'
   21 |     using wfilebuf = basic_filebuf<wchar_t>;
      |           ^~~~~~~~
p1560.cpp:22:59: error: spurious '>>', use '>' to terminate a template argument list
   22 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1560.cpp:23:13: error: template argument required for 'class basic_ifstream'
   23 |       class basic_ifstream;
      |             ^~~~~~~~~~~~~~
p1560.cpp:22:42: error: two or more data types in declaration of 'type name'
   22 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1560.cpp:23:27: error: expected '>' before ';' token
   23 |       class basic_ifstream;
      |                           ^
p1560.cpp:23:27: error: expected unqualified-id before ';' token
p1560.cpp:26:11: error: expected nested-name-specifier before 'ifstream'
   26 |     using ifstream  = basic_ifstream<char>;
      |           ^~~~~~~~
p1560.cpp:27:11: error: expected nested-name-specifier before 'wifstream'
   27 |     using wifstream = basic_ifstream<wchar_t>;
      |           ^~~~~~~~~
p1560.cpp:28:59: error: spurious '>>', use '>' to terminate a template argument list
   28 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1560.cpp:29:13: error: template argument required for 'class basic_ofstream'
   29 |       class basic_ofstream;
      |             ^~~~~~~~~~~~~~
p1560.cpp:28:42: error: two or more data types in declaration of 'type name'
   28 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1560.cpp:29:27: error: expected '>' before ';' token
   29 |       class basic_ofstream;
      |                           ^
p1560.cpp:29:27: error: expected unqualified-id before ';' token
p1560.cpp:32:14: error: expected nested-name-specifier before 'ofstream'
   32 |        using ofstream  = basic_ofstream<char>;
      |              ^~~~~~~~
p1560.cpp:33:14: error: expected nested-name-specifier before 'wofstream'
   33 |        using wofstream = basic_ofstream<wchar_t>;
      |              ^~~~~~~~~
p1560.cpp:34:62: error: spurious '>>', use '>' to terminate a template argument list
   34 |        template<class charT, class traits = char_traits<charT>>
      |                                                              ^~
p1560.cpp:35:16: error: template argument required for 'class basic_fstream'
   35 |          class basic_fstream;
      |                ^~~~~~~~~~~~~
p1560.cpp:34:45: error: two or more data types in declaration of 'type name'
   34 |        template<class charT, class traits = char_traits<charT>>
      |                                             ^~~~~~~~~~~~~~~~~~~
p1560.cpp:35:29: error: expected '>' before ';' token
   35 |          class basic_fstream;
      |                             ^
p1560.cpp:35:29: error: expected unqualified-id before ';' token
p1560.cpp:38:14: error: expected nested-name-specifier before 'fstream'
   38 |        using fstream  = basic_fstream<char>;
      |              ^~~~~~~
p1560.cpp:39:14: error: expected nested-name-specifier before 'wfstream'
   39 |        using wfstream = basic_fstream<wchar_t>;
      |              ^~~~~~~~
p1560.cpp:48:59: error: spurious '>>', use '>' to terminate a template argument list
   48 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1560.cpp:49:11: error: class template 'basic_filebuf' redeclared as non-template
   49 |     class basic_filebuf : public basic_streambuf<charT, traits> {
      |           ^~~~~~~~~~~~~
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:
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: previous declaration here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:49:57: error: 'traits' was not declared in this scope
   49 |     class basic_filebuf : public basic_streambuf<charT, traits> {
      |                                                         ^~~~~~
p1560.cpp:49:63: error: template argument 2 is invalid
   49 |     class basic_filebuf : public basic_streambuf<charT, traits> {
      |                                                               ^
p1560.cpp:48:42: error: two or more data types in declaration of 'type name'
   48 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1560.cpp:90:9: error: expected '>' before ';' token
   90 |        };
      |         ^
p1560.cpp:90:9: error: expected unqualified-id before ';' token
p1560.cpp:97:17: error: 'charT' was not declared in this scope; did you mean 'char'?
   97 |   const codecvt<charT, char, typename traits::state_type>& a_codecvt =
      |                 ^~~~~
      |                 char
p1560.cpp:97:57: error: template argument 1 is invalid
   97 |   const codecvt<charT, char, typename traits::state_type>& a_codecvt =
      |                                                         ^
p1560.cpp:97:57: error: template argument 3 is invalid
p1560.cpp:98:23: error: 'charT' was not declared in this scope; did you mean 'char'?
   98 |     use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
      |                       ^~~~~
      |                       char
p1560.cpp:98:74: error: template argument 1 is invalid
   98 |     use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
      |                                                                          ^
p1560.cpp:98:74: error: template argument 3 is invalid
p1560.cpp:98:5: error: parse error in template argument list
   98 |     use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1560.cpp:98:5: error: invalid initialization of reference of type 'const int&' from expression of type '<unresolved overloaded function type>'
p1560.cpp:100:16: error: expected constructor, destructor, or type conversion before ';' token
  100 | basic_filebuf();
      |                ^
p1560.cpp:101:14: error: expected constructor, destructor, or type conversion before '(' token
  101 | basic_filebuf(basic_filebuf&& rhs);
      |              ^
p1560.cpp:111:23: error: expected class-name before '(' token
  111 | virtual ~basic_filebuf();
      |                       ^
p1560.cpp:114:1: error: invalid use of template-name 'std::basic_filebuf' without an argument list
  114 | basic_filebuf& operator=(basic_filebuf&& rhs);
      | ^~~~~~~~~~~~~
p1560.cpp:114:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:117:6: error: variable or field 'swap' declared void
  117 | void swap(basic_filebuf& rhs);
      |      ^~~~
p1560.cpp:117:24: error: missing template arguments before '&' token
  117 | void swap(basic_filebuf& rhs);
      |                        ^
p1560.cpp:117:26: error: 'rhs' was not declared in this scope
  117 | void swap(basic_filebuf& rhs);
      |                          ^~~
p1560.cpp:119:25: error: 'charT' was not declared in this scope; did you mean 'char'?
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                         ^~~~~
      |                         char
p1560.cpp:119:32: error: 'traits' was not declared in this scope
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                ^~~~~~
p1560.cpp:119:38: error: template argument 1 is invalid
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                      ^
p1560.cpp:119:38: error: template argument 2 is invalid
p1560.cpp:119:58: error: 'charT' was not declared in this scope; did you mean 'char'?
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                                          ^~~~~
      |                                                          char
p1560.cpp:119:65: error: 'traits' was not declared in this scope
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                                                 ^~~~~~
p1560.cpp:119:71: error: template argument 1 is invalid
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                                                       ^
p1560.cpp:119:71: error: template argument 2 is invalid
p1560.cpp:122:16: error: non-member function 'bool is_open()' cannot have cv-qualifier
  122 | bool is_open() const;
      |                ^~~~~
p1560.cpp:124:1: error: invalid use of template-name 'std::basic_filebuf' without an argument list
  124 | basic_filebuf* open(const char* s, ios_base::openmode mode);
      | ^~~~~~~~~~~~~
p1560.cpp:124:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:125:1: error: invalid use of template-name 'std::basic_filebuf' without an argument list
  125 | basic_filebuf* open(const filesystem::path::value_type* s,
      | ^~~~~~~~~~~~~
p1560.cpp:125:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:130:1: error: invalid use of template-name 'std::basic_filebuf' without an argument list
  130 | basic_filebuf* open(const string& s, ios_base::openmode mode);
      | ^~~~~~~~~~~~~
p1560.cpp:130:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:131:1: error: invalid use of template-name 'std::basic_filebuf' without an argument list
  131 | basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
      | ^~~~~~~~~~~~~
p1560.cpp:131:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:138:22: warning: override controls (override/final) only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  138 | streamsize showmanyc() override;
      |                      ^
p1560.cpp:138:24: error: virt-specifiers in 'showmanyc' not allowed outside a class definition
  138 | streamsize showmanyc() override;
      |                        ^~~~~~~~
p1560.cpp:144:1: error: 'int_type' does not name a type
  144 | int_type underflow() override;
      | ^~~~~~~~
p1560.cpp:146:21: error: 'XSIZE' was not declared in this scope
  146 |   char   extern_buf[XSIZE];
      |                     ^~~~~
p1560.cpp:148:3: error: 'charT' does not name a type; did you mean 'char'?
  148 |   charT  intern_buf[ISIZE];
      |   ^~~~~
      |   char
p1560.cpp:149:3: error: 'charT' does not name a type; did you mean 'char'?
  149 |   charT* intern_end;
      |   ^~~~~
      |   char
p1560.cpp:150:17: error: invalid use of incomplete type 'class std::codecvt_base'
  150 |   codecvt_base::result r =
      |                 ^~~~~~
In file included from /usr/local/include/c++/12.1.0/ios:41:
/usr/local/include/c++/12.1.0/bits/localefwd.h:136:9: note: forward declaration of 'class std::codecvt_base'
  136 |   class codecvt_base;
      |         ^~~~~~~~~~~~
p1560.cpp:154:1: error: 'int_type' does not name a type
  154 | int_type uflow() override;
      | ^~~~~~~~
p1560.cpp:155:1: error: 'int_type' does not name a type
  155 | int_type pbackfail(int_type c = traits::eof()) override;
      | ^~~~~~~~
p1560.cpp:167:1: error: 'int_type' does not name a type
  167 | int_type overflow(int_type c = traits::eof()) override;
      | ^~~~~~~~
p1560.cpp:169:3: error: 'charT' does not name a type; did you mean 'char'?
  169 |   charT* b = pbase();
      |   ^~~~~
      |   char
p1560.cpp:170:3: error: 'charT' does not name a type; did you mean 'char'?
  170 |   charT* p = pptr();
      |   ^~~~~
      |   char
p1560.cpp:171:3: error: 'charT' does not name a type; did you mean 'char'?
  171 |   charT* end;
      |   ^~~~~
      |   char
p1560.cpp:172:15: error: 'XSIZE' was not declared in this scope
  172 |   char   xbuf[XSIZE];
      |               ^~~~~
p1560.cpp:174:17: error: invalid use of incomplete type 'class std::codecvt_base'
  174 |   codecvt_base::result r =
      |                 ^~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:136:9: note: forward declaration of 'class std::codecvt_base'
  136 |   class codecvt_base;
      |         ^~~~~~~~~~~~
p1560.cpp:182:1: error: invalid use of template-name 'std::basic_streambuf' without an argument list
  182 | basic_streambuf* setbuf(char_type* s, streamsize n) override;
      | ^~~~~~~~~~~~~~~
p1560.cpp:182:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/iosfwd:80:11: note: 'template<class _CharT, class _Traits> class std::basic_streambuf' declared here
   80 |     class basic_streambuf;
      |           ^~~~~~~~~~~~~~~
p1560.cpp:184:1: error: 'pos_type' does not name a type
  184 | pos_type seekoff(off_type off, ios_base::seekdir way,
      | ^~~~~~~~
p1560.cpp:191:15: error: expected unqualified-id before '=' token
  191 |               = ios_base::in | ios_base::out) override;
      |               ^
p1560.cpp:196:10: warning: override controls (override/final) only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  196 | int sync() override;
      |          ^
p1560.cpp:196:12: error: virt-specifiers in 'sync' not allowed outside a class definition
  196 | int sync() override;
      |            ^~~~~~~~
p1560.cpp:198:29: warning: override controls (override/final) only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  198 | void imbue(const locale& loc) override;
      |                             ^
p1560.cpp:198:31: error: virt-specifiers in 'imbue' not allowed outside a class definition
  198 | void imbue(const locale& loc) override;
      |                               ^~~~~~~~
p1560.cpp:205:59: error: spurious '>>', use '>' to terminate a template argument list
  205 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1560.cpp:206:11: error: class template 'basic_ifstream' redeclared as non-template
  206 |     class basic_ifstream : public basic_istream<charT, traits> {
      |           ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: previous declaration here
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:206:56: error: 'traits' was not declared in this scope
  206 |     class basic_ifstream : public basic_istream<charT, traits> {
      |                                                        ^~~~~~
p1560.cpp:206:62: error: template argument 2 is invalid
  206 |     class basic_ifstream : public basic_istream<charT, traits> {
      |                                                              ^
p1560.cpp:205:42: error: two or more data types in declaration of 'type name'
  205 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1560.cpp:239:2: error: expected '>' before ';' token
  239 | }; }
      |  ^
p1560.cpp:239:2: error: expected unqualified-id before ';' token
p1560.cpp:242:10: error: ISO C++ forbids declaration of 'basic_ifstream' with no type [-fpermissive]
  242 | explicit basic_ifstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:242:1: error: 'explicit' outside class declaration
  242 | explicit basic_ifstream(const char* s,
      | ^~~~~~~~
p1560.cpp:244:31: error: 'filesystem' does not name a type
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                               ^~~~~~~~~~
p1560.cpp:244:47: error: expected unqualified-id before '::' token
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:244:47: error: expected ')' before '::' token
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                        ~                      ^~
      |                                               )
p1560.cpp:244:47: error: expected initializer before '::' token
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:248:10: error: ISO C++ forbids declaration of 'basic_ifstream' with no type [-fpermissive]
  248 | explicit basic_ifstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:248:1: error: 'explicit' outside class declaration
  248 | explicit basic_ifstream(const string& s,
      | ^~~~~~~~
p1560.cpp:251:31: error: 'T' does not name a type
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      |                               ^
p1560.cpp:251:10: error: ISO C++ forbids declaration of 'basic_ifstream' with no type [-fpermissive]
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      |          ^~~~~~~~~~~~~~
p1560.cpp:251:1: error: 'explicit' outside class declaration
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      | ^~~~~~~~
p1560.cpp:253:18: error: expected constructor, destructor, or type conversion before '(' token
  253 |    basic_ifstream(basic_ifstream&& rhs);
      |                  ^
p1560.cpp:256:6: error: variable or field 'swap' declared void
  256 | void swap(basic_ifstream& rhs);
      |      ^~~~
p1560.cpp:256:11: error: reference to 'basic_ifstream' is ambiguous
  256 | void swap(basic_ifstream& rhs);
      |           ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ifstream'
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:251:10: note:                 'int basic_ifstream(const int&, std::ios_base::openmode)'
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      |          ^~~~~~~~~~~~~~
p1560.cpp:248:10: note:                 'int basic_ifstream(const std::string&, std::ios_base::openmode)'
  248 | explicit basic_ifstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:242:10: note:                 'int basic_ifstream(const char*, std::ios_base::openmode)'
  242 | explicit basic_ifstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:256:27: error: 'rhs' was not declared in this scope
  256 | void swap(basic_ifstream& rhs);
      |                           ^~~
p1560.cpp:259:8: error: variable or field 'swap' declared void
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |        ^~~~
p1560.cpp:259:13: error: reference to 'basic_ifstream' is ambiguous
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |             ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ifstream'
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:251:10: note:                 'int basic_ifstream(const int&, std::ios_base::openmode)'
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      |          ^~~~~~~~~~~~~~
p1560.cpp:248:10: note:                 'int basic_ifstream(const std::string&, std::ios_base::openmode)'
  248 | explicit basic_ifstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:242:10: note:                 'int basic_ifstream(const char*, std::ios_base::openmode)'
  242 | explicit basic_ifstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:259:33: error: expected primary-expression before ',' token
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |                                 ^
p1560.cpp:259:41: error: expected primary-expression before '>' token
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |                                         ^
p1560.cpp:259:44: error: 'x' was not declared in this scope
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |                                            ^
p1560.cpp:259:47: error: reference to 'basic_ifstream' is ambiguous
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |                                               ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ifstream'
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:251:10: note:                 'int basic_ifstream(const int&, std::ios_base::openmode)'
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      |          ^~~~~~~~~~~~~~
p1560.cpp:248:10: note:                 'int basic_ifstream(const std::string&, std::ios_base::openmode)'
  248 | explicit basic_ifstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:242:10: note:                 'int basic_ifstream(const char*, std::ios_base::openmode)'
  242 | explicit basic_ifstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:259:67: error: expected primary-expression before ',' token
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |                                                                   ^
p1560.cpp:259:75: error: expected primary-expression before '>' token
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |                                                                           ^
p1560.cpp:259:78: error: 'y' was not declared in this scope; did you mean 'yn'?
  259 |   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
      |                                                                              ^
      |                                                                              yn
p1560.cpp:262:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |               ^~~~~
      |               char
p1560.cpp:262:22: error: 'traits' was not declared in this scope
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |                      ^~~~~~
p1560.cpp:262:28: error: template argument 1 is invalid
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |                            ^
p1560.cpp:262:28: error: template argument 2 is invalid
p1560.cpp:262:39: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |                                       ^~~~~
p1560.cpp:266:17: error: 'filesystem' does not name a type
  266 | void open(const filesystem::path::value_type* s,
      |                 ^~~~~~~~~~
p1560.cpp:266:33: error: expected unqualified-id before '::' token
  266 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:266:33: error: expected ')' before '::' token
  266 | void open(const filesystem::path::value_type* s,
      |          ~                      ^~
      |                                 )
p1560.cpp:266:33: error: expected initializer before '::' token
  266 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:270:17: error: 'filesystem' does not name a type
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |                 ^~~~~~~~~~
p1560.cpp:270:33: error: expected unqualified-id before '&' token
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |                                 ^
p1560.cpp:270:33: error: expected ')' before '&' token
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |          ~                      ^
      |                                 )
p1560.cpp:270:35: error: expected initializer before 's'
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |                                   ^
p1560.cpp:276:59: error: spurious '>>', use '>' to terminate a template argument list
  276 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1560.cpp:277:11: error: class template 'basic_ofstream' redeclared as non-template
  277 |     class basic_ofstream : public basic_ostream<charT, traits> {
      |           ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: previous declaration here
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:277:56: error: 'traits' was not declared in this scope
  277 |     class basic_ofstream : public basic_ostream<charT, traits> {
      |                                                        ^~~~~~
p1560.cpp:277:62: error: template argument 2 is invalid
  277 |     class basic_ofstream : public basic_ostream<charT, traits> {
      |                                                              ^
p1560.cpp:276:42: error: two or more data types in declaration of 'type name'
  276 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1560.cpp:312:2: error: expected '>' before ';' token
  312 | }; }
      |  ^
p1560.cpp:312:2: error: expected unqualified-id before ';' token
p1560.cpp:315:10: error: ISO C++ forbids declaration of 'basic_ofstream' with no type [-fpermissive]
  315 | explicit basic_ofstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:315:1: error: 'explicit' outside class declaration
  315 | explicit basic_ofstream(const char* s,
      | ^~~~~~~~
p1560.cpp:317:31: error: 'filesystem' does not name a type
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                               ^~~~~~~~~~
p1560.cpp:317:47: error: expected unqualified-id before '::' token
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:317:47: error: expected ')' before '::' token
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                        ~                      ^~
      |                                               )
p1560.cpp:317:47: error: expected initializer before '::' token
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:320:10: error: ISO C++ forbids declaration of 'basic_ofstream' with no type [-fpermissive]
  320 | explicit basic_ofstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:320:1: error: 'explicit' outside class declaration
  320 | explicit basic_ofstream(const string& s,
      | ^~~~~~~~
p1560.cpp:323:31: error: 'T' does not name a type
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      |                               ^
p1560.cpp:323:10: error: ISO C++ forbids declaration of 'basic_ofstream' with no type [-fpermissive]
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      |          ^~~~~~~~~~~~~~
p1560.cpp:323:1: error: 'explicit' outside class declaration
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      | ^~~~~~~~
p1560.cpp:325:15: error: expected constructor, destructor, or type conversion before '(' token
  325 | basic_ofstream(basic_ofstream&& rhs);
      |               ^
p1560.cpp:328:6: error: variable or field 'swap' declared void
  328 | void swap(basic_ofstream& rhs);
      |      ^~~~
p1560.cpp:328:11: error: reference to 'basic_ofstream' is ambiguous
  328 | void swap(basic_ofstream& rhs);
      |           ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ofstream'
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:323:10: note:                 'int basic_ofstream(const int&, std::ios_base::openmode)'
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      |          ^~~~~~~~~~~~~~
p1560.cpp:320:10: note:                 'int basic_ofstream(const std::string&, std::ios_base::openmode)'
  320 | explicit basic_ofstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:315:10: note:                 'int basic_ofstream(const char*, std::ios_base::openmode)'
  315 | explicit basic_ofstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:328:27: error: 'rhs' was not declared in this scope
  328 | void swap(basic_ofstream& rhs);
      |                           ^~~
p1560.cpp:331:8: error: variable or field 'swap' declared void
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |        ^~~~
p1560.cpp:331:13: error: reference to 'basic_ofstream' is ambiguous
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |             ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ofstream'
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:323:10: note:                 'int basic_ofstream(const int&, std::ios_base::openmode)'
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      |          ^~~~~~~~~~~~~~
p1560.cpp:320:10: note:                 'int basic_ofstream(const std::string&, std::ios_base::openmode)'
  320 | explicit basic_ofstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:315:10: note:                 'int basic_ofstream(const char*, std::ios_base::openmode)'
  315 | explicit basic_ofstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:331:33: error: expected primary-expression before ',' token
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |                                 ^
p1560.cpp:331:41: error: expected primary-expression before '>' token
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |                                         ^
p1560.cpp:331:44: error: 'x' was not declared in this scope
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |                                            ^
p1560.cpp:331:47: error: reference to 'basic_ofstream' is ambiguous
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |                                               ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_ofstream'
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:323:10: note:                 'int basic_ofstream(const int&, std::ios_base::openmode)'
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      |          ^~~~~~~~~~~~~~
p1560.cpp:320:10: note:                 'int basic_ofstream(const std::string&, std::ios_base::openmode)'
  320 | explicit basic_ofstream(const string& s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:315:10: note:                 'int basic_ofstream(const char*, std::ios_base::openmode)'
  315 | explicit basic_ofstream(const char* s,
      |          ^~~~~~~~~~~~~~
p1560.cpp:331:67: error: expected primary-expression before ',' token
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |                                                                   ^
p1560.cpp:331:75: error: expected primary-expression before '>' token
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |                                                                           ^
p1560.cpp:331:78: error: 'y' was not declared in this scope; did you mean 'yn'?
  331 |   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
      |                                                                              ^
      |                                                                              yn
p1560.cpp:334:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |               ^~~~~
      |               char
p1560.cpp:334:22: error: 'traits' was not declared in this scope
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |                      ^~~~~~
p1560.cpp:334:28: error: template argument 1 is invalid
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |                            ^
p1560.cpp:334:28: error: template argument 2 is invalid
p1560.cpp:334:39: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |                                       ^~~~~
p1560.cpp:337:6: error: default argument given for parameter 2 of 'void open(const char*, std::ios_base::openmode)'
  337 | void open(const char* s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:265:6: note: previous specification in 'void open(const char*, std::ios_base::openmode)' here
  265 | void open(const char* s, ios_base::openmode mode = ios_base::in);
      |      ^~~~
p1560.cpp:338:17: error: 'filesystem' does not name a type
  338 | void open(const filesystem::path::value_type* s,
      |                 ^~~~~~~~~~
p1560.cpp:338:33: error: expected unqualified-id before '::' token
  338 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:338:33: error: expected ')' before '::' token
  338 | void open(const filesystem::path::value_type* s,
      |          ~                      ^~
      |                                 )
p1560.cpp:338:33: error: expected initializer before '::' token
  338 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:343:6: error: default argument given for parameter 2 of 'void open(const std::string&, std::ios_base::openmode)'
  343 | void open(const string& s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:269:6: note: previous specification in 'void open(const std::string&, std::ios_base::openmode)' here
  269 | void open(const string& s, ios_base::openmode mode = ios_base::in);
      |      ^~~~
p1560.cpp:344:17: error: 'filesystem' does not name a type
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |                 ^~~~~~~~~~
p1560.cpp:344:33: error: expected unqualified-id before '&' token
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |                                 ^
p1560.cpp:344:33: error: expected ')' before '&' token
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |          ~                      ^
      |                                 )
p1560.cpp:344:35: error: expected initializer before 's'
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |                                   ^
p1560.cpp:349:59: error: spurious '>>', use '>' to terminate a template argument list
  349 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1560.cpp:350:11: error: class template 'basic_fstream' redeclared as non-template
  350 |     class basic_fstream : public basic_iostream<charT, traits> {
      |           ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: previous declaration here
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:350:56: error: 'traits' was not declared in this scope
  350 |     class basic_fstream : public basic_iostream<charT, traits> {
      |                                                        ^~~~~~
p1560.cpp:350:62: error: template argument 2 is invalid
  350 |     class basic_fstream : public basic_iostream<charT, traits> {
      |                                                              ^
p1560.cpp:349:42: error: two or more data types in declaration of 'type name'
  349 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1560.cpp:395:2: error: expected '>' before ';' token
  395 | }; }
      |  ^
p1560.cpp:395:2: error: expected unqualified-id before ';' token
p1560.cpp:399:10: error: ISO C++ forbids declaration of 'basic_fstream' with no type [-fpermissive]
  399 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:399:1: error: 'explicit' outside class declaration
  399 | explicit basic_fstream(
      | ^~~~~~~~
p1560.cpp:403:9: error: 'filesystem' does not name a type
  403 |   const filesystem::path::value_type* s,
      |         ^~~~~~~~~~
p1560.cpp:403:25: error: expected unqualified-id before '::' token
  403 |   const filesystem::path::value_type* s,
      |                         ^~
p1560.cpp:403:25: error: expected ')' before '::' token
  403 |   const filesystem::path::value_type* s,
      |                         ^~
      |                         )
p1560.cpp:402:23: note: to match this '('
  402 | explicit basic_fstream(
      |                       ^
p1560.cpp:403:25: error: expected initializer before '::' token
  403 |   const filesystem::path::value_type* s,
      |                         ^~
p1560.cpp:407:10: error: ISO C++ forbids declaration of 'basic_fstream' with no type [-fpermissive]
  407 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:407:1: error: 'explicit' outside class declaration
  407 | explicit basic_fstream(
      | ^~~~~~~~
p1560.cpp:411:30: error: 'T' does not name a type
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      |                              ^
p1560.cpp:411:10: error: ISO C++ forbids declaration of 'basic_fstream' with no type [-fpermissive]
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      |          ^~~~~~~~~~~~~
p1560.cpp:411:1: error: 'explicit' outside class declaration
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      | ^~~~~~~~
p1560.cpp:413:14: error: expected constructor, destructor, or type conversion before '(' token
  413 | basic_fstream(basic_fstream&& rhs);
      |              ^
p1560.cpp:416:6: error: variable or field 'swap' declared void
  416 | void swap(basic_fstream& rhs);
      |      ^~~~
p1560.cpp:416:11: error: reference to 'basic_fstream' is ambiguous
  416 | void swap(basic_fstream& rhs);
      |           ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_fstream'
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:411:10: note:                 'int basic_fstream(const int&, std::ios_base::openmode)'
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      |          ^~~~~~~~~~~~~
p1560.cpp:407:10: note:                 'int basic_fstream(const std::string&, std::ios_base::openmode)'
  407 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:399:10: note:                 'int basic_fstream(const char*, std::ios_base::openmode)'
  399 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:416:26: error: 'rhs' was not declared in this scope
  416 | void swap(basic_fstream& rhs);
      |                          ^~~
p1560.cpp:419:8: error: variable or field 'swap' declared void
  419 |   void swap(basic_fstream<charT, traits>& x,
      |        ^~~~
p1560.cpp:419:13: error: reference to 'basic_fstream' is ambiguous
  419 |   void swap(basic_fstream<charT, traits>& x,
      |             ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_fstream'
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:411:10: note:                 'int basic_fstream(const int&, std::ios_base::openmode)'
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      |          ^~~~~~~~~~~~~
p1560.cpp:407:10: note:                 'int basic_fstream(const std::string&, std::ios_base::openmode)'
  407 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:399:10: note:                 'int basic_fstream(const char*, std::ios_base::openmode)'
  399 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:419:32: error: expected primary-expression before ',' token
  419 |   void swap(basic_fstream<charT, traits>& x,
      |                                ^
p1560.cpp:419:40: error: expected primary-expression before '>' token
  419 |   void swap(basic_fstream<charT, traits>& x,
      |                                        ^
p1560.cpp:419:43: error: 'x' was not declared in this scope
  419 |   void swap(basic_fstream<charT, traits>& x,
      |                                           ^
p1560.cpp:420:13: error: reference to 'basic_fstream' is ambiguous
  420 |             basic_fstream<charT, traits>& y);
      |             ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: candidates are: 'template<class _CharT, class _Traits> class std::basic_fstream'
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:411:10: note:                 'int basic_fstream(const int&, std::ios_base::openmode)'
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      |          ^~~~~~~~~~~~~
p1560.cpp:407:10: note:                 'int basic_fstream(const std::string&, std::ios_base::openmode)'
  407 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:399:10: note:                 'int basic_fstream(const char*, std::ios_base::openmode)'
  399 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
p1560.cpp:420:32: error: expected primary-expression before ',' token
  420 |             basic_fstream<charT, traits>& y);
      |                                ^
p1560.cpp:420:40: error: expected primary-expression before '>' token
  420 |             basic_fstream<charT, traits>& y);
      |                                        ^
p1560.cpp:420:43: error: 'y' was not declared in this scope; did you mean 'yn'?
  420 |             basic_fstream<charT, traits>& y);
      |                                           ^
      |                                           yn
p1560.cpp:423:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |               ^~~~~
      |               char
p1560.cpp:423:22: error: 'traits' was not declared in this scope
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |                      ^~~~~~
p1560.cpp:423:28: error: template argument 1 is invalid
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |                            ^
p1560.cpp:423:28: error: template argument 2 is invalid
p1560.cpp:423:39: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |                                       ^~~~~
p1560.cpp:426:6: error: default argument given for parameter 2 of 'void open(const char*, std::ios_base::openmode)'
  426 | void open(
      |      ^~~~
p1560.cpp:337:6: note: previous specification in 'void open(const char*, std::ios_base::openmode)' here
  337 | void open(const char* s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:430:7: error: 'filesystem' does not name a type
  430 | const filesystem::path::value_type* s,
      |       ^~~~~~~~~~
p1560.cpp:430:23: error: expected unqualified-id before '::' token
  430 | const filesystem::path::value_type* s,
      |                       ^~
p1560.cpp:430:23: error: expected ')' before '::' token
  430 | const filesystem::path::value_type* s,
      |                       ^~
      |                       )
p1560.cpp:429:10: note: to match this '('
  429 | void open(
      |          ^
p1560.cpp:430:23: error: expected initializer before '::' token
  430 | const filesystem::path::value_type* s,
      |                       ^~
p1560.cpp:433:6: error: default argument given for parameter 2 of 'void open(const std::string&, std::ios_base::openmode)'
  433 | void open(
      |      ^~~~
p1560.cpp:343:6: note: previous specification in 'void open(const std::string&, std::ios_base::openmode)' here
  343 | void open(const string& s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:437:9: error: 'filesystem' does not name a type
  437 |   const filesystem::path& s,
      |         ^~~~~~~~~~
p1560.cpp:437:25: error: expected unqualified-id before '&' token
  437 |   const filesystem::path& s,
      |                         ^
p1560.cpp:437:25: error: expected ')' before '&' token
  437 |   const filesystem::path& s,
      |                         ^
      |                         )
p1560.cpp:436:10: note: to match this '('
  436 | void open(
      |          ^
p1560.cpp:437:27: error: expected initializer before 's'
  437 |   const filesystem::path& s,
      |                           ^

$ g++ p1560.cpp -std=2b -o p1560g -I. -Wall
p1560.cpp:16:27: error: redefinition of default argument for 'class traits'
   16 |     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 p1560.cpp:10:
/usr/local/include/c++/12.1.0/iosfwd:112:29: note: original definition appeared here
  112 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:22:27: error: redefinition of default argument for 'class traits'
   22 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:115:29: note: original definition appeared here
  115 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:28:27: error: redefinition of default argument for 'class traits'
   28 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:118:29: note: original definition appeared here
  118 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:34:30: error: redefinition of default argument for 'class traits'
   34 |        template<class charT, class traits = char_traits<charT>>
      |                              ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:121:29: note: original definition appeared here
  121 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:48:27: error: redefinition of default argument for 'class traits'
   48 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:112:29: note: original definition appeared here
  112 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:97:17: error: 'charT' was not declared in this scope; did you mean 'char'?
   97 |   const codecvt<charT, char, typename traits::state_type>& a_codecvt =
      |                 ^~~~~
      |                 char
p1560.cpp:97:57: error: template argument 1 is invalid
   97 |   const codecvt<charT, char, typename traits::state_type>& a_codecvt =
      |                                                         ^
p1560.cpp:97:57: error: template argument 3 is invalid
p1560.cpp:98:23: error: 'charT' was not declared in this scope; did you mean 'char'?
   98 |     use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
      |                       ^~~~~
      |                       char
p1560.cpp:98:63: error: template argument 1 is invalid
   98 |     use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
      |                                                               ^~
p1560.cpp:98:63: error: template argument 3 is invalid
p1560.cpp:98:66: error: 'getloc' was not declared in this scope; did you mean 'getwc'?
   98 |     use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
      |                                                                  ^~~~~~
      |                                                                  getwc
p1560.cpp:98:5: error: parse error in template argument list
   98 |     use_facet<codecvt<charT, char, typename traits::state_type>>(getloc());
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1560.cpp:98:5: error: invalid initialization of reference of type 'const int&' from expression of type '<unresolved overloaded function type>'
p1560.cpp:100:1: error: deduction guide for 'std::basic_filebuf<_CharT, _Traits>' must have trailing return type
  100 | basic_filebuf();
      | ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:101:15: error: template placeholder type 'basic_filebuf<...auto...>' must be followed by a simple declarator-id
  101 | basic_filebuf(basic_filebuf&& rhs);
      |               ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:101:1: error: deduction guide for 'std::basic_filebuf<_CharT, _Traits>' must have trailing return type
  101 | basic_filebuf(basic_filebuf&& rhs);
      | ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:111:23: error: expected class-name before '(' token
  111 | virtual ~basic_filebuf();
      |                       ^
p1560.cpp:114:26: error: template placeholder type 'basic_filebuf<...auto...>' must be followed by a simple declarator-id
  114 | basic_filebuf& operator=(basic_filebuf&& rhs);
      |                          ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:114:1: error: deduced class type 'basic_filebuf' in function return type
  114 | basic_filebuf& operator=(basic_filebuf&& rhs);
      | ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:117:11: error: template placeholder type 'basic_filebuf<...auto...>' must be followed by a simple declarator-id
  117 | void swap(basic_filebuf& rhs);
      |           ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:119:25: error: 'charT' was not declared in this scope; did you mean 'char'?
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                         ^~~~~
      |                         char
p1560.cpp:119:32: error: 'traits' was not declared in this scope
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                ^~~~~~
p1560.cpp:119:38: error: template argument 1 is invalid
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                      ^
p1560.cpp:119:38: error: template argument 2 is invalid
p1560.cpp:119:58: error: 'charT' was not declared in this scope; did you mean 'char'?
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                                          ^~~~~
      |                                                          char
p1560.cpp:119:65: error: 'traits' was not declared in this scope
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                                                 ^~~~~~
p1560.cpp:119:71: error: template argument 1 is invalid
  119 | void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
      |                                                                       ^
p1560.cpp:119:71: error: template argument 2 is invalid
p1560.cpp:122:16: error: non-member function 'bool is_open()' cannot have cv-qualifier
  122 | bool is_open() const;
      |                ^~~~~
p1560.cpp:124:1: error: deduced class type 'basic_filebuf' in function return type
  124 | basic_filebuf* open(const char* s, ios_base::openmode mode);
      | ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:125:27: error: 'filesystem' does not name a type
  125 | basic_filebuf* open(const filesystem::path::value_type* s,
      |                           ^~~~~~~~~~
p1560.cpp:125:43: error: expected unqualified-id before '::' token
  125 | basic_filebuf* open(const filesystem::path::value_type* s,
      |                                           ^~
p1560.cpp:125:43: error: expected ')' before '::' token
  125 | basic_filebuf* open(const filesystem::path::value_type* s,
      |                    ~                      ^~
      |                                           )
p1560.cpp:125:43: error: expected initializer before '::' token
  125 | basic_filebuf* open(const filesystem::path::value_type* s,
      |                                           ^~
p1560.cpp:130:1: error: deduced class type 'basic_filebuf' in function return type
  130 | basic_filebuf* open(const string& s, ios_base::openmode mode);
      | ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:113:11: note: 'template<class _CharT, class _Traits> class std::basic_filebuf' declared here
  113 |     class basic_filebuf;
      |           ^~~~~~~~~~~~~
p1560.cpp:131:27: error: 'filesystem' does not name a type
  131 | basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
      |                           ^~~~~~~~~~
p1560.cpp:131:43: error: expected unqualified-id before '&' token
  131 | basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
      |                                           ^
p1560.cpp:131:43: error: expected ')' before '&' token
  131 | basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
      |                    ~                      ^
      |                                           )
p1560.cpp:131:45: error: expected initializer before 's'
  131 | basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
      |                                             ^
p1560.cpp:138:24: error: virt-specifiers in 'showmanyc' not allowed outside a class definition
  138 | streamsize showmanyc() override;
      |                        ^~~~~~~~
p1560.cpp:144:1: error: 'int_type' does not name a type
  144 | int_type underflow() override;
      | ^~~~~~~~
p1560.cpp:146:21: error: 'XSIZE' was not declared in this scope
  146 |   char   extern_buf[XSIZE];
      |                     ^~~~~
p1560.cpp:148:3: error: 'charT' does not name a type; did you mean 'char'?
  148 |   charT  intern_buf[ISIZE];
      |   ^~~~~
      |   char
p1560.cpp:149:3: error: 'charT' does not name a type; did you mean 'char'?
  149 |   charT* intern_end;
      |   ^~~~~
      |   char
p1560.cpp:150:17: error: invalid use of incomplete type 'class std::codecvt_base'
  150 |   codecvt_base::result r =
      |                 ^~~~~~
In file included from /usr/local/include/c++/12.1.0/ios:41:
/usr/local/include/c++/12.1.0/bits/localefwd.h:136:9: note: forward declaration of 'class std::codecvt_base'
  136 |   class codecvt_base;
      |         ^~~~~~~~~~~~
p1560.cpp:154:1: error: 'int_type' does not name a type
  154 | int_type uflow() override;
      | ^~~~~~~~
p1560.cpp:155:1: error: 'int_type' does not name a type
  155 | int_type pbackfail(int_type c = traits::eof()) override;
      | ^~~~~~~~
p1560.cpp:167:1: error: 'int_type' does not name a type
  167 | int_type overflow(int_type c = traits::eof()) override;
      | ^~~~~~~~
p1560.cpp:169:3: error: 'charT' does not name a type; did you mean 'char'?
  169 |   charT* b = pbase();
      |   ^~~~~
      |   char
p1560.cpp:170:3: error: 'charT' does not name a type; did you mean 'char'?
  170 |   charT* p = pptr();
      |   ^~~~~
      |   char
p1560.cpp:171:3: error: 'charT' does not name a type; did you mean 'char'?
  171 |   charT* end;
      |   ^~~~~
      |   char
p1560.cpp:172:15: error: 'XSIZE' was not declared in this scope
  172 |   char   xbuf[XSIZE];
      |               ^~~~~
p1560.cpp:174:17: error: invalid use of incomplete type 'class std::codecvt_base'
  174 |   codecvt_base::result r =
      |                 ^~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:136:9: note: forward declaration of 'class std::codecvt_base'
  136 |   class codecvt_base;
      |         ^~~~~~~~~~~~
p1560.cpp:182:1: error: template placeholder type 'basic_streambuf<...auto...>' must be followed by a simple declarator-id
  182 | basic_streambuf* setbuf(char_type* s, streamsize n) override;
      | ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:80:11: note: 'template<class _CharT, class _Traits> class std::basic_streambuf' declared here
   80 |     class basic_streambuf;
      |           ^~~~~~~~~~~~~~~
p1560.cpp:182:25: error: 'char_type' was not declared in this scope
  182 | basic_streambuf* setbuf(char_type* s, streamsize n) override;
      |                         ^~~~~~~~~
p1560.cpp:182:36: error: 's' was not declared in this scope
  182 | basic_streambuf* setbuf(char_type* s, streamsize n) override;
      |                                    ^
p1560.cpp:182:50: error: expected primary-expression before 'n'
  182 | basic_streambuf* setbuf(char_type* s, streamsize n) override;
      |                                                  ^
p1560.cpp:184:1: error: 'pos_type' does not name a type
  184 | pos_type seekoff(off_type off, ios_base::seekdir way,
      | ^~~~~~~~
p1560.cpp:191:15: error: expected unqualified-id before '=' token
  191 |               = ios_base::in | ios_base::out) override;
      |               ^
p1560.cpp:196:12: error: virt-specifiers in 'sync' not allowed outside a class definition
  196 | int sync() override;
      |            ^~~~~~~~
p1560.cpp:196:5: error: ambiguating new declaration of 'int sync()'
  196 | int sync() override;
      |     ^~~~
In file included from /usr/local/include/c++/12.1.0/bits/atomic_wait.h:44,
                 from /usr/local/include/c++/12.1.0/bits/atomic_base.h:41,
                 from /usr/local/include/c++/12.1.0/atomic:41,
                 from N4910.h:11:
/usr/include/unistd.h:970:13: note: old declaration 'void sync()'
  970 | extern void sync (void) __THROW;
      |             ^~~~
p1560.cpp:198:31: error: virt-specifiers in 'imbue' not allowed outside a class definition
  198 | void imbue(const locale& loc) override;
      |                               ^~~~~~~~
p1560.cpp:205:27: error: redefinition of default argument for 'class traits'
  205 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:115:29: note: original definition appeared here
  115 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:242:10: error: deduction guide for 'std::basic_ifstream<_CharT, _Traits>' must have trailing return type
  242 | explicit basic_ifstream(const char* s,
      |          ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: 'template<class _CharT, class _Traits> class std::basic_ifstream' declared here
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:244:31: error: 'filesystem' does not name a type
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                               ^~~~~~~~~~
p1560.cpp:244:47: error: expected unqualified-id before '::' token
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:244:47: error: expected ')' before '::' token
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                        ~                      ^~
      |                                               )
p1560.cpp:244:47: error: expected initializer before '::' token
  244 | explicit basic_ifstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:248:10: error: deduction guide for 'std::basic_ifstream<_CharT, _Traits>' must have trailing return type
  248 | explicit basic_ifstream(const string& s,
      |          ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: 'template<class _CharT, class _Traits> class std::basic_ifstream' declared here
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:251:31: error: 'T' does not name a type
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      |                               ^
p1560.cpp:251:10: error: deduction guide for 'std::basic_ifstream<_CharT, _Traits>' must have trailing return type
  251 | explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
      |          ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: 'template<class _CharT, class _Traits> class std::basic_ifstream' declared here
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:253:19: error: template placeholder type 'basic_ifstream<...auto...>' must be followed by a simple declarator-id
  253 |    basic_ifstream(basic_ifstream&& rhs);
      |                   ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: 'template<class _CharT, class _Traits> class std::basic_ifstream' declared here
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:253:4: error: deduction guide for 'std::basic_ifstream<_CharT, _Traits>' must have trailing return type
  253 |    basic_ifstream(basic_ifstream&& rhs);
      |    ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: 'template<class _CharT, class _Traits> class std::basic_ifstream' declared here
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:256:11: error: template placeholder type 'basic_ifstream<...auto...>' must be followed by a simple declarator-id
  256 | void swap(basic_ifstream& rhs);
      |           ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:116:11: note: 'template<class _CharT, class _Traits> class std::basic_ifstream' declared here
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:262:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |               ^~~~~
      |               char
p1560.cpp:262:22: error: 'traits' was not declared in this scope
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |                      ^~~~~~
p1560.cpp:262:28: error: template argument 1 is invalid
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |                            ^
p1560.cpp:262:28: error: template argument 2 is invalid
p1560.cpp:262:39: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  262 | basic_filebuf<charT, traits>* rdbuf() const;
      |                                       ^~~~~
p1560.cpp:266:17: error: 'filesystem' does not name a type
  266 | void open(const filesystem::path::value_type* s,
      |                 ^~~~~~~~~~
p1560.cpp:266:33: error: expected unqualified-id before '::' token
  266 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:266:33: error: expected ')' before '::' token
  266 | void open(const filesystem::path::value_type* s,
      |          ~                      ^~
      |                                 )
p1560.cpp:266:33: error: expected initializer before '::' token
  266 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:270:17: error: 'filesystem' does not name a type
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |                 ^~~~~~~~~~
p1560.cpp:270:33: error: expected unqualified-id before '&' token
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |                                 ^
p1560.cpp:270:33: error: expected ')' before '&' token
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |          ~                      ^
      |                                 )
p1560.cpp:270:35: error: expected initializer before 's'
  270 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
      |                                   ^
p1560.cpp:276:27: error: redefinition of default argument for 'class traits'
  276 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:118:29: note: original definition appeared here
  118 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:315:10: error: deduction guide for 'std::basic_ofstream<_CharT, _Traits>' must have trailing return type
  315 | explicit basic_ofstream(const char* s,
      |          ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: 'template<class _CharT, class _Traits> class std::basic_ofstream' declared here
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:317:31: error: 'filesystem' does not name a type
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                               ^~~~~~~~~~
p1560.cpp:317:47: error: expected unqualified-id before '::' token
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:317:47: error: expected ')' before '::' token
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                        ~                      ^~
      |                                               )
p1560.cpp:317:47: error: expected initializer before '::' token
  317 | explicit basic_ofstream(const filesystem::path::value_type* s,
      |                                               ^~
p1560.cpp:320:10: error: deduction guide for 'std::basic_ofstream<_CharT, _Traits>' must have trailing return type
  320 | explicit basic_ofstream(const string& s,
      |          ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: 'template<class _CharT, class _Traits> class std::basic_ofstream' declared here
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:323:31: error: 'T' does not name a type
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      |                               ^
p1560.cpp:323:10: error: deduction guide for 'std::basic_ofstream<_CharT, _Traits>' must have trailing return type
  323 | explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
      |          ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: 'template<class _CharT, class _Traits> class std::basic_ofstream' declared here
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:325:16: error: template placeholder type 'basic_ofstream<...auto...>' must be followed by a simple declarator-id
  325 | basic_ofstream(basic_ofstream&& rhs);
      |                ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: 'template<class _CharT, class _Traits> class std::basic_ofstream' declared here
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:325:1: error: deduction guide for 'std::basic_ofstream<_CharT, _Traits>' must have trailing return type
  325 | basic_ofstream(basic_ofstream&& rhs);
      | ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: 'template<class _CharT, class _Traits> class std::basic_ofstream' declared here
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:328:11: error: template placeholder type 'basic_ofstream<...auto...>' must be followed by a simple declarator-id
  328 | void swap(basic_ofstream& rhs);
      |           ^~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:119:11: note: 'template<class _CharT, class _Traits> class std::basic_ofstream' declared here
  119 |     class basic_ofstream;
      |           ^~~~~~~~~~~~~~
p1560.cpp:334:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |               ^~~~~
      |               char
p1560.cpp:334:22: error: 'traits' was not declared in this scope
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |                      ^~~~~~
p1560.cpp:334:28: error: template argument 1 is invalid
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |                            ^
p1560.cpp:334:28: error: template argument 2 is invalid
p1560.cpp:334:39: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  334 | basic_filebuf<charT, traits>* rdbuf() const;
      |                                       ^~~~~
p1560.cpp:337:6: error: default argument given for parameter 2 of 'void open(const char*, std::ios_base::openmode)'
  337 | void open(const char* s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:265:6: note: previous specification in 'void open(const char*, std::ios_base::openmode)' here
  265 | void open(const char* s, ios_base::openmode mode = ios_base::in);
      |      ^~~~
p1560.cpp:338:17: error: 'filesystem' does not name a type
  338 | void open(const filesystem::path::value_type* s,
      |                 ^~~~~~~~~~
p1560.cpp:338:33: error: expected unqualified-id before '::' token
  338 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:338:33: error: expected ')' before '::' token
  338 | void open(const filesystem::path::value_type* s,
      |          ~                      ^~
      |                                 )
p1560.cpp:338:33: error: expected initializer before '::' token
  338 | void open(const filesystem::path::value_type* s,
      |                                 ^~
p1560.cpp:343:6: error: default argument given for parameter 2 of 'void open(const std::string&, std::ios_base::openmode)'
  343 | void open(const string& s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:269:6: note: previous specification in 'void open(const std::string&, std::ios_base::openmode)' here
  269 | void open(const string& s, ios_base::openmode mode = ios_base::in);
      |      ^~~~
p1560.cpp:344:17: error: 'filesystem' does not name a type
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |                 ^~~~~~~~~~
p1560.cpp:344:33: error: expected unqualified-id before '&' token
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |                                 ^
p1560.cpp:344:33: error: expected ')' before '&' token
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |          ~                      ^
      |                                 )
p1560.cpp:344:35: error: expected initializer before 's'
  344 | void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
      |                                   ^
p1560.cpp:349:27: error: redefinition of default argument for 'class traits'
  349 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:121:29: note: original definition appeared here
  121 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1560.cpp:399:10: error: deduction guide for 'std::basic_fstream<_CharT, _Traits>' must have trailing return type
  399 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: 'template<class _CharT, class _Traits> class std::basic_fstream' declared here
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:403:9: error: 'filesystem' does not name a type
  403 |   const filesystem::path::value_type* s,
      |         ^~~~~~~~~~
p1560.cpp:403:25: error: expected unqualified-id before '::' token
  403 |   const filesystem::path::value_type* s,
      |                         ^~
p1560.cpp:403:25: error: expected ')' before '::' token
  403 |   const filesystem::path::value_type* s,
      |                         ^~
      |                         )
p1560.cpp:402:23: note: to match this '('
  402 | explicit basic_fstream(
      |                       ^
p1560.cpp:403:25: error: expected initializer before '::' token
  403 |   const filesystem::path::value_type* s,
      |                         ^~
p1560.cpp:407:10: error: deduction guide for 'std::basic_fstream<_CharT, _Traits>' must have trailing return type
  407 | explicit basic_fstream(
      |          ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: 'template<class _CharT, class _Traits> class std::basic_fstream' declared here
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:411:30: error: 'T' does not name a type
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      |                              ^
p1560.cpp:411:10: error: deduction guide for 'std::basic_fstream<_CharT, _Traits>' must have trailing return type
  411 | explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
      |          ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: 'template<class _CharT, class _Traits> class std::basic_fstream' declared here
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:413:15: error: template placeholder type 'basic_fstream<...auto...>' must be followed by a simple declarator-id
  413 | basic_fstream(basic_fstream&& rhs);
      |               ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: 'template<class _CharT, class _Traits> class std::basic_fstream' declared here
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:413:1: error: deduction guide for 'std::basic_fstream<_CharT, _Traits>' must have trailing return type
  413 | basic_fstream(basic_fstream&& rhs);
      | ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: 'template<class _CharT, class _Traits> class std::basic_fstream' declared here
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:416:11: error: template placeholder type 'basic_fstream<...auto...>' must be followed by a simple declarator-id
  416 | void swap(basic_fstream& rhs);
      |           ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:122:11: note: 'template<class _CharT, class _Traits> class std::basic_fstream' declared here
  122 |     class basic_fstream;
      |           ^~~~~~~~~~~~~
p1560.cpp:423:15: error: 'charT' was not declared in this scope; did you mean 'char'?
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |               ^~~~~
      |               char
p1560.cpp:423:22: error: 'traits' was not declared in this scope
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |                      ^~~~~~
p1560.cpp:423:28: error: template argument 1 is invalid
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |                            ^
p1560.cpp:423:28: error: template argument 2 is invalid
p1560.cpp:423:39: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
  423 | basic_filebuf<charT, traits>* rdbuf() const;
      |                                       ^~~~~
p1560.cpp:426:6: error: default argument given for parameter 2 of 'void open(const char*, std::ios_base::openmode)'
  426 | void open(
      |      ^~~~
p1560.cpp:337:6: note: previous specification in 'void open(const char*, std::ios_base::openmode)' here
  337 | void open(const char* s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:430:7: error: 'filesystem' does not name a type
  430 | const filesystem::path::value_type* s,
      |       ^~~~~~~~~~
p1560.cpp:430:23: error: expected unqualified-id before '::' token
  430 | const filesystem::path::value_type* s,
      |                       ^~
p1560.cpp:430:23: error: expected ')' before '::' token
  430 | const filesystem::path::value_type* s,
      |                       ^~
      |                       )
p1560.cpp:429:10: note: to match this '('
  429 | void open(
      |          ^
p1560.cpp:430:23: error: expected initializer before '::' token
  430 | const filesystem::path::value_type* s,
      |                       ^~
p1560.cpp:433:6: error: default argument given for parameter 2 of 'void open(const std::string&, std::ios_base::openmode)'
  433 | void open(
      |      ^~~~
p1560.cpp:343:6: note: previous specification in 'void open(const std::string&, std::ios_base::openmode)' here
  343 | void open(const string& s, ios_base::openmode mode = ios_base::out);
      |      ^~~~
p1560.cpp:437:9: error: 'filesystem' does not name a type
  437 |   const filesystem::path& s,
      |         ^~~~~~~~~~
p1560.cpp:437:25: error: expected unqualified-id before '&' token
  437 |   const filesystem::path& s,
      |                         ^
p1560.cpp:437:25: error: expected ')' before '&' token
  437 |   const filesystem::path& s,
      |                         ^
      |                         )
p1560.cpp:436:10: note: to match this '('
  436 | void open(
      |          ^
p1560.cpp:437:27: error: expected initializer before 's'
  437 |   const filesystem::path& s,
      |                           ^

検討事項(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)

自己参考資料(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 初稿  20220829

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?