エンジニア夏休み企画
個人開発と読書感想文に焦点を当てたのは良い企画だと思った。
読書感想文
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.9 Span-based streams [span.streams] C++N4910:2022 (692) p1553.cpp
算譜(source code)
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "31.9 Span-based streams [span.streams] C++N4910:2022 (692) p1553.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.9.1 Overview [span.streams.overview]
// The header <spanstream> defines class templates and types that associate stream buffers with objects whose
types are specializations of span as described in 24.7.3.
// [Note 1: A user of these classes is responsible for ensuring that the character sequence represented by the given span outlives the use of the sequence by objects of the classes in subclause 31.9. Using multiple basic_spanbuf objects referring to overlapping underlying sequences from different threads, where at least one basic_spanbuf object is used for writing to the sequence, results in a data race. —end note]
// 31.9.2 Header <spanstream> synopsis [spanstream.syn]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_spanbuf;
using spanbuf = basic_spanbuf<char>;
using wspanbuf = basic_spanbuf<wchar_t>;
template<class charT, class traits = char_traits<charT>>
class basic_ispanstream;
using ispanstream = basic_ispanstream<char>;
using wispanstream = basic_ispanstream<wchar_t>;
template<class charT, class traits = char_traits<charT>>
class basic_ospanstream;
using ospanstream = basic_ospanstream<char>;
using wospanstream = basic_ospanstream<wchar_t>;
template<class charT, class traits = char_traits<charT>>
class basic_spanstream;
using spanstream = basic_spanstream<char>;
using wspanstream = basic_spanstream<wchar_t>;
}
// — ios_base::openmode mode , has in set if the input sequence can be read, and out set if the output sequence can be written.
// 31.9.3 Class template spanbuf [spanbuf]
// 31.9.3.1 General [spanbuf.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_spanbuf
: 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.9.3.2, constructors
basic_spanbuf() : basic_spanbuf(ios_base::in | ios_base::out) {} explicit basic_spanbuf(ios_base::openmode which)
: basic_spanbuf(std::span<charT>(), which) {}
explicit basic_spanbuf(std::span<charT> s,
ios_base::openmode which = ios_base::in | ios_base::out);
basic_spanbuf(const basic_spanbuf&) = delete;
basic_spanbuf(basic_spanbuf&& rhs);
// 31.9.3.3, assignment and swap
basic_spanbuf& operator=(const basic_spanbuf&) = delete;
basic_spanbuf& operator=(basic_spanbuf&& rhs);
void swap(basic_spanbuf& rhs);
// 31.9.3.4, member functions std::span<charT> span() const noexcept; void span(std::span<charT> s) noexcept;
protected:
// 31.9.3.5, overridden virtual functions
basic_streambuf<charT, traits>* setbuf(charT*, streamsize) 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;
private:
ios_base::openmode mode ; // exposition only std::span<charT> buf ; // exposition only
};
template<class charT, class traits>
void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
}
// The class template basic_spanbuf is derived from basic_streambuf to associate possibly the input sequence and possibly the output sequence with a sequence of arbitrary characters. The sequence is provided by an object of class span<charT>.
// For the sake of exposition, the maintained data is presented here as:
// — std::span<charT> buf is the view to the underlying character sequence.
// 31.9.3.2 Constructors [spanbuf.ctor]
explicit basic_spanbuf(std::span<charT> s,
ios_base::openmode which = ios_base::in | ios_base::out);
// Effects: Initializes the base class with basic_streambuf() (31.6.3.2), and mode with which. Initializes the internal pointers as if calling span(s).
basic_spanbuf(basic_spanbuf&& rhs);
// Effects: Initializes the base class with std::move(rhs) and mode with std::move(rhs.mode ) and buf with std::move(rhs.buf). The sequence pointers in *this (eback(), gptr(), egptr(), pbase(), pptr(), epptr()) obtain the values which rhs had. It is implementation-defined whether rhs.buf . empty() returns true after the move.
// Postconditions: Let rhs_p refer to the state of rhs just prior to this construction. — span().data() == rhs_p.span().data()
// — span().size() == rhs_p.span().size()
// — eback() == rhs_p.eback()
// — gptr() == rhs_p.gptr()
// — egptr() == rhs_p.egptr() — pbase() == rhs_p.pbase() — pptr() == rhs_p.pptr()
// — epptr() == rhs_p.epptr() — getloc() == rhs_p.getloc()
// 31.9.3.3 Assignment and swap [spanbuf.assign]
basic_spanbuf& operator=(basic_spanbuf&& rhs);
// Effects: Equivalent to:
basic_spanbuf tmp{std::move(rhs)};
this->swap(tmp);
return *this;
void swap(basic_spanbuf& rhs);
// Effects: Equivalent to:
basic_streambuf<charT, traits>::swap(rhs);
std::swap(mode, rhs.mode);
std::swap(buf, rhs.buf);
template<class charT, class traits>
void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
// Effects: Equivalent to x.swap(y).
// 31.9.3.4 Member functions [spanbuf.members]
std::span<charT> span() const noexcept;
// Returns: If ios_base::out is set in mode , returns std::span<charT>(pbase(), pptr()), otherwise returns buf .
// [Note 1: In contrast to basic_stringbuf, the underlying sequence never grows and is not owned. An owning copy can be obtained by converting the result to basic_string<charT>. —end note]
void span(std::span<charT> s) noexcept;
// Effects: buf = s. Initializes the input and output sequences according to mode . Postconditions:—
// — If ios_base::out is set in mode ,
pbase() == s.data() && epptr() == pbase() + s.size() is true;
// — in addition, if ios_base::ate is set in mode , pptr() == pbase() + s.size() is true,
// — otherwise pptr() == pbase() is true.
// If ios_base::in is set in mode , eback() == s.data() && gptr() == eback() && egptr() == eback() + s.size() is true.
// Effects: Alters the stream position within one or both of the controlled sequences, if possible, as follows:
// — If ios_base::in is set in which, positions the input sequence; xnext is gptr(), xbeg is eback().
// — If ios_base::out is set in which, positions the output sequence; xnext is pptr(), xbeg is pbase().
// If both ios_base::in and ios_base::out are set in which and way is ios_base::cur, the positioning operation fails.
// For a sequence to be positioned, if its next pointer xnext (either gptr() or pptr()) is a null pointer and the new offset newoff as computed below is nonzero, the positioning operation fails. Otherwise, the function determines baseoff as a value of type off_type as follows:
// — 0 when way is ios_base::beg;
// — (pptr() - pbase()) for the output sequence, or (gptr() - eback()) for the input sequence when way is ios_base::cur; — when way is ios_base::end :
// — (pptr() - pbase()) if ios_base::out is set in mode and ios_base::in is not set in mode ,
// — buf.size() otherwise.
// If baseoff + off would overflow, or if baseoff + off is less than zero, or if baseoff + off is greater than buf .size(), the positioning operation fails. Otherwise, the function computes
off_type newoff = baseoff + off;
// and assigns xbeg + newoff to the next pointer xnext.
// Returns: pos_type(off_type(-1)) if the positioning operation fails; pos_type(newoff) otherwise.
// 31.9.3.5 Overridden virtual functions [spanbuf.virtuals]
// [Note 1: Because the underlying buffer is of fixed size, neither overflow, underflow, nor pbackfail can provide useful behavior. —end note]
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;
// Effects: Equivalent to:
return seekoff(off_type(sp), ios_base::beg, which);
basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
// Effects: Equivalent to:
this->span(std::span<charT>(s, n));
return this;
// 31.9.4 Class template basic_ispanstream [ispanstream]
// 31.9.4.1 General [ispanstream.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_ispanstream
: 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;
// 31.9.4.2, constructors
explicit basic_ispanstream(std::span<charT> s,
ios_base::openmode which = ios_base::in);
basic_ispanstream(const basic_ispanstream&) = delete;
basic_ispanstream(basic_ispanstream&& rhs);
template<class ROS> explicit basic_ispanstream(ROS&& s);
Effects:
Initializes the base class with basic_istream<charT, traits>(addressof(sb)) and sb with basic_spanbuf<charT, traits>(s, which | ios_base::in)
basic_ispanstream& operator=(const basic_ispanstream&) = delete;
basic_ispanstream& operator=(basic_ispanstream&& rhs);
// 31.9.4.3, swap
void swap(basic_ispanstream& rhs);
// 31.9.4.4, member functions
basic_spanbuf<charT, traits>* rdbuf() const noexcept;
std::span<const charT> span() const noexcept;
void span(std::span<charT> s) noexcept;
template<class ROS> void span(ROS&& s) noexcept;
private:
basic_spanbuf<charT, traits> sb; // exposition only
};
template<class charT, class traits>
void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
}
// [Note 1: Constructing an ispanstream from a string-literal includes the termination character ’\0’ in the underlying
spanbuf.
// 31.9.4.2 Constructors [ispanstream.ctor]
explicit basic_ispanstream(std::span<charT> s, ios_base::openmode which = ios_base::in);
basic_ispanstream(basic_ispanstream&& rhs);
// Effects: Initializes the base class with std::move(rhs) and sb with std::move(rhs.sb). Next, basic_- istream<charT, traits>::set_rdbuf(addressof(sb)) is called to install the contained basic_- spanbuf.
template<class ROS> explicit basic_ispanstream(ROS&& s)
// Constraints: ROS models ranges::borrowed_range. !convertible_to<ROS, std::span<charT>> && convertible_to<ROS, std::span<charT const>> is true.
// Effects: Let sp be std::span<const charT>(std::forward<ROS>(s)). Equivalent to basic_ispanstream(std::span<charT>(const_cast<charT*>(sp.data()), sp.size()))
// 31.9.4.3 Swap [ispanstream.swap]
void swap(basic_ispanstream& rhs);
// Effects: Equivalent to:
basic_istream<charT, traits>::swap(rhs);
sb.swap(rhs.sb);
template<class charT, class traits>
void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
// Effects: Equivalent to x.swap(y).
// 31.9.4.4 Member functions [ispanstream.members]
basic_spanbuf<charT, traits>* rdbuf() const noexcept;
// Effects: Equivalent to:
return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
std::span<const charT> span() const noexcept;
// Effects: Equivalent to:
return rdbuf()->span();
void span(std::span<charT> s) noexcept;
// Effects: Equivalent to rdbuf()->span(s).
template<class ROS> void span(ROS&& s) noexcept;
// Effects: Initializes the base class with basic_ostream<charT, traits>(addressof(sb)) and sb with basic_spanbuf<charT, traits>(s, which | ios_base::out)
// Constraints: ROS models ranges::borrowed_range. (!convertible_to<ROS, std::span<charT>>) && convertible_to<ROS, std::span<const charT>> is true.
// Effects: Let sp be std::span<const charT>(std::forward<ROS>(s)). Equivalent to: this->span(std::span<charT>(const_cast<charT*>(sp.data()), sp.size()))
// 31.9.5 Class template basic_ospanstream [ospanstream]
// 31.9.5.1 General [ospanstream.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_ospanstream
: 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.9.5.2, constructors
explicit basic_ospanstream(std::span<charT> s,
ios_base::openmode which = ios_base::out);
basic_ospanstream(const basic_ospanstream&) = delete;
basic_ospanstream(basic_ospanstream&& rhs);
basic_ospanstream& operator=(const basic_ospanstream&) = delete;
basic_ospanstream& operator=(basic_ospanstream&& rhs);
// 31.9.5.3, swap
void swap(basic_ospanstream& rhs);
// 31.9.5.4, member functions
basic_spanbuf<charT, traits>* rdbuf() const noexcept;
std::span<charT> span() const noexcept;
void span(std::span<charT> s) noexcept;
private:
basic_spanbuf<charT, traits> sb; // exposition only };
template<class charT, class traits>
void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
};
}
// 31.9.5.2 Constructors [ospanstream.ctor]
explicit basic_ospanstream(std::span<charT> s,
ios_base::openmode which = ios_base::out);
basic_ospanstream(basic_ospanstream&& rhs) noexcept;
// Effects: Initializes the base class with std::move(rhs) and sb with std::move(rhs.sb). Next, basic_- ostream<charT, traits>::set_rdbuf(addressof(sb)) is called to install the contained basic_- spanbuf.
// 31.9.5.3 Swap [ospanstream.swap]
void swap(basic_ospanstream& rhs);
// Effects: Equivalent to:
basic_ostream<charT, traits>::swap(rhs);
sb.swap(rhs.sb);
template<class charT, class traits>
void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
// Effects: Equivalent to x.swap(y).
// 31.9.5.4 Member functions [ospanstream.members]
basic_spanbuf<charT, traits>* rdbuf() const noexcept;
// Effects: Equivalent to:
return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
std::span<charT> span() const noexcept;
// Effects: Equivalent to: return rdbuf()->span(); void span(std::span<charT> s) noexcept;
// Effects: Equivalent to rdbuf()->span(s).
// 31.9.6 Class template basic_spanstream [spanstream]
// 31.9.6.1 General [spanstream.general]
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_spanstream
: public basic_iostream<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.9.6.2, constructors
explicit basic_spanstream(std::span<charT> s,
ios_base::openmode which = ios_base::out | ios_base::in);
basic_spanstream(const basic_spanstream&) = delete;
basic_spanstream(basic_spanstream&& rhs);
basic_spanstream& operator=(const basic_spanstream&) = delete;
basic_spanstream& operator=(basic_spanstream&& rhs);
// 31.9.6.3, swap
void swap(basic_spanstream& rhs);
// 31.9.6.4, members
basic_spanbuf<charT, traits>* rdbuf() const noexcept;
std::span<charT> span() const noexcept;
void span(std::span<charT> s) noexcept;
private:
basic_spanbuf<charT, traits> sb; // exposition only };
template<class charT, class traits>
void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
// 31.9.6.2 Constructors [spanstream.ctor]
explicit basic_spanstream(std::span<charT> s,
ios_base::openmode which = ios_base::out | ios_bas::in);
// Effects: Initializes the base class with basic_iostream<charT, traits>(addressof(sb)) and sb with basic_spanbuf<charT, traits>(s, which) (31.9.3.2).
basic_spanstream(basic_spanstream&& rhs);
// Effects: Initializes the base class with std::move(rhs) and sb with std::move(rhs.sb). Next, basic_iostream<charT, traits>::set_rdbuf(addressof(sb)) is called to install the contained basic_spanbuf.
// 31.9.6.3 Swap [spanstream.swap]
void swap(basic_spanstream& rhs);
// Effects: Equivalent to:
basic_iostream<charT, traits>::swap(rhs);
sb.swap(rhs.sb);
template<class charT, class traits>
void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
// Effects: Equivalent to x.swap(y).
// 31.9.6.4 Member functions [spanstream.members]
basic_spanbuf<charT, traits>* rdbuf() const noexcept;
// Effects: Equivalent to:
return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
std::span<charT> span() const noexcept;
// Effects: Equivalent to: return rdbuf()->span(); void span(std::span<charT> s) noexcept;
// Effects: Equivalent to rdbuf()->span(s).
}
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang++ p1553.cpp -std=03 -o p1553l -I. -Wall
In file included from p1553.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 \
^
p1553.cpp:16:1: error: unknown type name 'types'
types are specializations of span as described in 24.7.3.
^
p1553.cpp:16:10: error: expected ';' after top level declarator
types are specializations of span as described in 24.7.3.
^
;
p1553.cpp:80:7: error: C++ requires a type specifier for all declarations
basic_spanbuf(basic_spanbuf&& rhs);
^
p1553.cpp:80:37: error: use of undeclared identifier 'rhs'
basic_spanbuf(basic_spanbuf&& rhs);
^
p1553.cpp:89:1: error: unknown type name 'basic_spanbuf'
basic_spanbuf& operator=(basic_spanbuf&& rhs);
^
p1553.cpp:89:26: error: unknown type name 'basic_spanbuf'
basic_spanbuf& operator=(basic_spanbuf&& rhs);
^
p1553.cpp:89:39: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
basic_spanbuf& operator=(basic_spanbuf&& rhs);
^
p1553.cpp:91:3: error: unknown type name 'basic_spanbuf'
basic_spanbuf tmp{std::move(rhs)};
^
p1553.cpp:91:20: error: expected ';' after top level declarator
basic_spanbuf tmp{std::move(rhs)};
^
;
p1553.cpp:92:3: error: expected unqualified-id
this->swap(tmp);
^
p1553.cpp:93:3: error: expected unqualified-id
return *this;
^
p1553.cpp:94:6: error: variable has incomplete type 'void'
void swap(basic_spanbuf& rhs);
^
p1553.cpp:94:26: error: use of undeclared identifier 'rhs'
void swap(basic_spanbuf& rhs);
^
p1553.cpp:96:17: error: use of undeclared identifier 'charT'; did you mean 'char'?
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^~~~~
char
p1553.cpp:96:24: error: use of undeclared identifier 'traits'
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^
p1553.cpp:96:54: error: use of undeclared identifier 'mode'; did you mean 'modf'?
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^~~~
modf
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cmath:372:11: note: 'modf' declared here
using ::modf;
^
p1553.cpp:96:49: error: C++ requires a type specifier for all declarations
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^
p1553.cpp:97:6: error: C++ requires a type specifier for all declarations
std::swap(buf, rhs.buf);
^
p1553.cpp:97:11: error: use of undeclared identifier 'buf'
std::swap(buf, rhs.buf);
^
p1553.cpp:99:8: warning: variable templates are a C++14 extension [-Wc++14-extensions]
void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
$ clang++ p1553.cpp -std=2b -o p1553l -I. -Wall
p1553.cpp:16:1: error: unknown type name 'types'
types are specializations of span as described in 24.7.3.
^
p1553.cpp:16:10: error: expected ';' after top level declarator
types are specializations of span as described in 24.7.3.
^
;
p1553.cpp:80:7: error: C++ requires a type specifier for all declarations
basic_spanbuf(basic_spanbuf&& rhs);
^
p1553.cpp:80:37: error: use of undeclared identifier 'rhs'
basic_spanbuf(basic_spanbuf&& rhs);
^
p1553.cpp:89:1: error: unknown type name 'basic_spanbuf'
basic_spanbuf& operator=(basic_spanbuf&& rhs);
^
p1553.cpp:89:26: error: unknown type name 'basic_spanbuf'
basic_spanbuf& operator=(basic_spanbuf&& rhs);
^
p1553.cpp:91:3: error: unknown type name 'basic_spanbuf'
basic_spanbuf tmp{std::move(rhs)};
^
p1553.cpp:91:31: error: use of undeclared identifier 'rhs'
basic_spanbuf tmp{std::move(rhs)};
^
p1553.cpp:92:3: error: expected unqualified-id
this->swap(tmp);
^
p1553.cpp:93:3: error: expected unqualified-id
return *this;
^
p1553.cpp:94:6: error: variable has incomplete type 'void'
void swap(basic_spanbuf& rhs);
^
p1553.cpp:94:26: error: use of undeclared identifier 'rhs'
void swap(basic_spanbuf& rhs);
^
p1553.cpp:96:17: error: use of undeclared identifier 'charT'; did you mean 'char'?
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^~~~~
char
p1553.cpp:96:24: error: use of undeclared identifier 'traits'
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^
p1553.cpp:96:49: error: C++ requires a type specifier for all declarations
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^
p1553.cpp:96:54: error: use of undeclared identifier 'mode'
basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
^
p1553.cpp:97:6: error: C++ requires a type specifier for all declarations
std::swap(buf, rhs.buf);
^
p1553.cpp:97:11: error: use of undeclared identifier 'buf'
std::swap(buf, rhs.buf);
^
p1553.cpp:99:8: error: variable has incomplete type 'void'
void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ g++ p1553.cpp -std=03 -o p1553g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from N4910.h:11,
from p1553.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 \
| ^~~~~
p1553.cpp:16:51: error: too many decimal points in number
16 | types are specializations of span as described in 24.7.3.
| ^~~~~~~
p1553.cpp:102:31: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
102 | std::span<charT> span() const noexcept;
| ^~~~~~~~
p1553.cpp:16:1: error: 'types' does not name a type
16 | types are specializations of span as described in 24.7.3.
| ^~~~~
p1553.cpp:41:59: error: spurious '>>', use '>' to terminate a template argument list
41 | template<class charT, class traits = char_traits<charT>>
| ^~
p1553.cpp:43:39: error: 'traits' was not declared in this scope
43 | : public basic_streambuf<charT, traits> {
| ^~~~~~
p1553.cpp:43:45: error: template argument 2 is invalid
43 | : public basic_streambuf<charT, traits> {
| ^
p1553.cpp:43:47: error: definition of 'class std::basic_spanbuf' inside template parameter list
43 | : public basic_streambuf<charT, traits> {
| ^
p1553.cpp:41:42: error: two or more data types in declaration of 'type name'
41 | template<class charT, class traits = char_traits<charT>>
| ^~~~~~~~~~~~~~~~~~~
p1553.cpp:69:2: error: expected '>' before ';' token
69 | };
| ^
p1553.cpp:69:2: error: expected unqualified-id before ';' token
p1553.cpp:71:13: error: variable or field 'swap' declared void
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^~~~
p1553.cpp:71:18: error: 'basic_spanbuf' was not declared in this scope; did you mean 'basic_streambuf'?
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^~~~~~~~~~~~~
| basic_streambuf
p1553.cpp:71:37: error: expected primary-expression before ',' token
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:71:45: error: expected primary-expression before '>' token
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:71:48: error: 'x' was not declared in this scope
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:71:51: error: 'basic_spanbuf' was not declared in this scope; did you mean 'basic_streambuf'?
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^~~~~~~~~~~~~
| basic_streambuf
p1553.cpp:71:70: error: expected primary-expression before ',' token
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:71:78: error: expected primary-expression before '>' token
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:71:81: error: 'y' was not declared in this scope; did you mean 'yn'?
71 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
| yn
p1553.cpp:77:10: error: ISO C++ forbids declaration of 'basic_spanbuf' with no type [-fpermissive]
77 | explicit basic_spanbuf(std::span<charT> s,
| ^~~~~~~~~~~~~
p1553.cpp:77:1: error: 'explicit' outside class declaration
77 | explicit basic_spanbuf(std::span<charT> s,
| ^~~~~~~~
p1553.cpp:77:29: error: 'span' is not a member of 'std'
77 | explicit basic_spanbuf(std::span<charT> s,
| ^~~~
p1553.cpp:77:34: error: 'charT' was not declared in this scope; did you mean 'char'?
77 | explicit basic_spanbuf(std::span<charT> s,
| ^~~~~
| char
p1553.cpp:77:41: error: 's' was not declared in this scope
77 | explicit basic_spanbuf(std::span<charT> s,
| ^
p1553.cpp:78:20: error: expected primary-expression before 'which'
78 | ios_base::openmode which = ios_base::in | ios_base::out);
| ^~~~~
p1553.cpp:78:56: error: expression list treated as compound expression in initializer [-fpermissive]
78 | ios_base::openmode which = ios_base::in | ios_base::out);
| ^
p1553.cpp:80:20: error: expected constructor, destructor, or type conversion before '(' token
80 | basic_spanbuf(basic_spanbuf&& rhs);
| ^
p1553.cpp:89:1: error: 'basic_spanbuf' does not name a type
89 | basic_spanbuf& operator=(basic_spanbuf&& rhs);
| ^~~~~~~~~~~~~
p1553.cpp:91:3: error: 'basic_spanbuf' does not name a type
91 | basic_spanbuf tmp{std::move(rhs)};
| ^~~~~~~~~~~~~
p1553.cpp:92:3: error: expected unqualified-id before 'this'
92 | this->swap(tmp);
| ^~~~
p1553.cpp:93:3: error: expected unqualified-id before 'return'
93 | return *this;
| ^~~~~~
p1553.cpp:94:6: error: variable or field 'swap' declared void
94 | void swap(basic_spanbuf& rhs);
| ^~~~
p1553.cpp:94:26: error: 'rhs' was not declared in this scope
94 | void swap(basic_spanbuf& rhs);
| ^~~
p1553.cpp:96:17: error: 'charT' was not declared in this scope; did you mean 'char'?
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~~~
| char
p1553.cpp:96:24: error: 'traits' was not declared in this scope
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~~~~
p1553.cpp:96:30: error: template argument 1 is invalid
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^
p1553.cpp:96:30: error: template argument 2 is invalid
p1553.cpp:96:38: error: 'rhs' was not declared in this scope
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~
p1553.cpp:96:53: error: expected constructor, destructor, or type conversion before '(' token
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^
p1553.cpp:97:10: error: expected constructor, destructor, or type conversion before '(' token
97 | std::swap(buf, rhs.buf);
| ^
p1553.cpp:99:8: error: variable or field 'swap' declared void
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^~~~
p1553.cpp:99:32: error: expected primary-expression before ',' token
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:99:40: error: expected primary-expression before '>' token
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:99:43: error: 'x' was not declared in this scope
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:99:65: error: expected primary-expression before ',' token
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:99:73: error: expected primary-expression before '>' token
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
p1553.cpp:99:76: error: 'y' was not declared in this scope; did you mean 'yn'?
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^
| yn
p1553.cpp:102:6: error: 'span' in namespace 'std' does not name a template type
102 | std::span<charT> span() const noexcept;
| ^~~~
p1553.cpp:105:6: error: variable or field 'span' declared void
105 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:105:16: error: 'span' is not a member of 'std'
105 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:105:21: error: 'charT' was not declared in this scope; did you mean 'char'?
105 | void span(std::span<charT> s) noexcept;
| ^~~~~
| char
p1553.cpp:105:28: error: 's' was not declared in this scope
105 | void span(std::span<charT> s) noexcept;
| ^
p1553.cpp:108:9: error: expected constructor, destructor, or type conversion before '==' token
108 | pbase() == s.data() && epptr() == pbase() + s.size() is true;
| ^~
p1553.cpp:122:1: error: 'off_type' does not name a type; did you mean 'off_t'?
122 | off_type newoff = baseoff + off;
| ^~~~~~~~
| off_t
p1553.cpp:127:4: error: 'pos_type' does not name a type
127 | pos_type seekoff(off_type off, ios_base::seekdir way,
| ^~~~~~~~
p1553.cpp:129:1: error: 'pos_type' does not name a type
129 | pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;
| ^~~~~~~~
p1553.cpp:131:1: error: expected unqualified-id before 'return'
131 | return seekoff(off_type(sp), ios_base::beg, which);
| ^~~~~~
p1553.cpp:132:17: error: 'charT' was not declared in this scope; did you mean 'char'?
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~
| char
p1553.cpp:132:24: error: 'traits' was not declared in this scope
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~~
p1553.cpp:132:30: error: template argument 1 is invalid
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^
p1553.cpp:132:30: error: template argument 2 is invalid
p1553.cpp:132:40: error: 'int* setbuf' redeclared as different kind of entity
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~
In file included from /usr/local/include/c++/12.1.0/cstdio:42,
from N4910.h:3:
/usr/include/stdio.h:304:13: note: previous declaration 'void setbuf(FILE*, char*)'
304 | extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
| ^~~~~~
p1553.cpp:132:40: error: 'charT' was not declared in this scope; did you mean 'char'?
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~
| char
p1553.cpp:132:47: error: 's' was not declared in this scope
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^
p1553.cpp:132:61: error: expected primary-expression before 'n'
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^
p1553.cpp:134:1: error: expected unqualified-id before 'this'
134 | this->span(std::span<charT>(s, n));
| ^~~~
p1553.cpp:135:1: error: expected unqualified-id before 'return'
135 | return this;
| ^~~~~~
p1553.cpp:139:59: error: spurious '>>', use '>' to terminate a template argument list
139 | template<class charT, class traits = char_traits<charT>>
| ^~
p1553.cpp:141:37: error: 'traits' was not declared in this scope
141 | : public basic_istream<charT, traits> {
| ^~~~~~
p1553.cpp:141:43: error: template argument 2 is invalid
141 | : public basic_istream<charT, traits> {
| ^
p1553.cpp:141:45: error: definition of 'class std::basic_ispanstream' inside template parameter list
141 | : public basic_istream<charT, traits> {
| ^
p1553.cpp:139:42: error: two or more data types in declaration of 'type name'
139 | template<class charT, class traits = char_traits<charT>>
| ^~~~~~~~~~~~~~~~~~~
p1553.cpp:166:2: error: expected '>' before ';' token
166 | };
| ^
p1553.cpp:166:2: error: expected unqualified-id before ';' token
p1553.cpp:168:15: error: variable or field 'swap' declared void
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^~~~
p1553.cpp:168:20: error: 'basic_ispanstream' was not declared in this scope; did you mean 'basic_istream'?
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^~~~~~~~~~~~~~~~~
| basic_istream
p1553.cpp:168:43: error: expected primary-expression before ',' token
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:168:51: error: expected primary-expression before '>' token
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:168:54: error: 'x' was not declared in this scope
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:168:57: error: 'basic_ispanstream' was not declared in this scope; did you mean 'basic_istream'?
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^~~~~~~~~~~~~~~~~
| basic_istream
p1553.cpp:168:80: error: expected primary-expression before ',' token
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:168:88: error: expected primary-expression before '>' token
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:168:91: error: 'y' was not declared in this scope; did you mean 'yn'?
168 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
| yn
p1553.cpp:171:1: error: 'spanbuf' does not name a type
171 | spanbuf.
| ^~~~~~~
p1553.cpp:174:18: error: expected constructor, destructor, or type conversion before '(' token
174 | basic_ispanstream(basic_ispanstream&& rhs);
| ^
p1553.cpp:176:51: error: expected ',' or '...' before '&&' token
176 | template<class ROS> explicit basic_ispanstream(ROS&& s)
| ^~
p1553.cpp:180:1: error: expected initializer before 'void'
180 | void swap(basic_ispanstream& rhs);
| ^~~~
p1553.cpp:182:15: error: 'charT' was not declared in this scope; did you mean 'char'?
182 | basic_istream<charT, traits>::swap(rhs);
| ^~~~~
| char
p1553.cpp:182:22: error: 'traits' was not declared in this scope
182 | basic_istream<charT, traits>::swap(rhs);
| ^~~~~~
p1553.cpp:182:28: error: template argument 1 is invalid
182 | basic_istream<charT, traits>::swap(rhs);
| ^
p1553.cpp:182:28: error: template argument 2 is invalid
p1553.cpp:182:31: error: redefinition of 'int swap'
182 | basic_istream<charT, traits>::swap(rhs);
| ^~~~
p1553.cpp:96:33: note: 'int swap' previously defined here
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~~
p1553.cpp:182:36: error: 'rhs' was not declared in this scope
182 | basic_istream<charT, traits>::swap(rhs);
| ^~~
p1553.cpp:183:3: error: 'sb' does not name a type
183 | sb.swap(rhs.sb);
| ^~
p1553.cpp:185:8: error: variable or field 'swap' declared void
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^~~~
p1553.cpp:185:13: error: 'basic_ispanstream' was not declared in this scope
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^~~~~~~~~~~~~~~~~
p1553.cpp:185:36: error: expected primary-expression before ',' token
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:185:44: error: expected primary-expression before '>' token
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:185:47: error: 'x' was not declared in this scope
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:185:50: error: 'basic_ispanstream' was not declared in this scope
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^~~~~~~~~~~~~~~~~
p1553.cpp:185:73: error: expected primary-expression before ',' token
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:185:81: error: expected primary-expression before '>' token
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
p1553.cpp:185:84: error: 'y' was not declared in this scope; did you mean 'yn'?
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^
| yn
p1553.cpp:188:1: error: 'basic_spanbuf' does not name a type
188 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~~~~~~
p1553.cpp:190:1: error: expected unqualified-id before 'return'
190 | return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
| ^~~~~~
p1553.cpp:191:6: error: 'span' in namespace 'std' does not name a template type
191 | std::span<const charT> span() const noexcept;
| ^~~~
p1553.cpp:193:1: error: expected unqualified-id before 'return'
193 | return rdbuf()->span();
| ^~~~~~
p1553.cpp:194:6: error: variable or field 'span' declared void
194 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:194:16: error: 'span' is not a member of 'std'
194 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:194:21: error: 'charT' was not declared in this scope; did you mean 'char'?
194 | void span(std::span<charT> s) noexcept;
| ^~~~~
| char
p1553.cpp:194:28: error: 's' was not declared in this scope
194 | void span(std::span<charT> s) noexcept;
| ^
p1553.cpp:196:34: error: expected ',' or '...' before '&&' token
196 | template<class ROS> void span(ROS&& s) noexcept;
| ^~
p1553.cpp:196:40: error: expected initializer before 'noexcept'
196 | template<class ROS> void span(ROS&& s) noexcept;
| ^~~~~~~~
p1553.cpp:203:59: error: spurious '>>', use '>' to terminate a template argument list
203 | template<class charT, class traits = char_traits<charT>>
| ^~
p1553.cpp:205:37: error: 'traits' was not declared in this scope
205 | : public basic_ostream<charT, traits> {
| ^~~~~~
p1553.cpp:205:43: error: template argument 2 is invalid
205 | : public basic_ostream<charT, traits> {
| ^
p1553.cpp:205:45: error: definition of 'class std::basic_ospanstream' inside template parameter list
205 | : public basic_ostream<charT, traits> {
| ^
p1553.cpp:203:42: error: two or more data types in declaration of 'type name'
203 | template<class charT, class traits = char_traits<charT>>
| ^~~~~~~~~~~~~~~~~~~
p1553.cpp:229:2: error: expected '>' before ';' token
229 | };
| ^
p1553.cpp:229:2: error: expected unqualified-id before ';' token
p1553.cpp:232:10: error: ISO C++ forbids declaration of 'basic_ospanstream' with no type [-fpermissive]
232 | explicit basic_ospanstream(std::span<charT> s,
| ^~~~~~~~~~~~~~~~~
p1553.cpp:232:1: error: 'explicit' outside class declaration
232 | explicit basic_ospanstream(std::span<charT> s,
| ^~~~~~~~
p1553.cpp:232:33: error: 'span' is not a member of 'std'
232 | explicit basic_ospanstream(std::span<charT> s,
| ^~~~
p1553.cpp:232:38: error: 'charT' was not declared in this scope; did you mean 'char'?
232 | explicit basic_ospanstream(std::span<charT> s,
| ^~~~~
| char
p1553.cpp:232:45: error: 's' was not declared in this scope
232 | explicit basic_ospanstream(std::span<charT> s,
| ^
p1553.cpp:233:47: error: expected primary-expression before 'which'
233 | ios_base::openmode which = ios_base::out);
| ^~~~~
p1553.cpp:233:68: error: expression list treated as compound expression in initializer [-fpermissive]
233 | ios_base::openmode which = ios_base::out);
| ^
p1553.cpp:234:18: error: expected constructor, destructor, or type conversion before '(' token
234 | basic_ospanstream(basic_ospanstream&& rhs) noexcept;
| ^
p1553.cpp:237:9: error: variable or field 'swap' declared void
237 | void swap(basic_ospanstream& rhs);
| ^~~~
p1553.cpp:237:33: error: 'rhs' was not declared in this scope
237 | void swap(basic_ospanstream& rhs);
| ^~~
p1553.cpp:239:15: error: 'charT' was not declared in this scope; did you mean 'char'?
239 | basic_ostream<charT, traits>::swap(rhs);
| ^~~~~
| char
p1553.cpp:239:22: error: 'traits' was not declared in this scope
239 | basic_ostream<charT, traits>::swap(rhs);
| ^~~~~~
p1553.cpp:239:28: error: template argument 1 is invalid
239 | basic_ostream<charT, traits>::swap(rhs);
| ^
p1553.cpp:239:28: error: template argument 2 is invalid
p1553.cpp:239:31: error: redefinition of 'int swap'
239 | basic_ostream<charT, traits>::swap(rhs);
| ^~~~
p1553.cpp:96:33: note: 'int swap' previously defined here
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~~
p1553.cpp:239:36: error: 'rhs' was not declared in this scope
239 | basic_ostream<charT, traits>::swap(rhs);
| ^~~
p1553.cpp:240:3: error: 'sb' does not name a type
240 | sb.swap(rhs.sb);
| ^~
p1553.cpp:242:8: error: variable or field 'swap' declared void
242 | void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
| ^~~~
p1553.cpp:242:36: error: expected primary-expression before ',' token
242 | void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
| ^
p1553.cpp:242:44: error: expected primary-expression before '>' token
242 | void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
| ^
p1553.cpp:242:47: error: 'x' was not declared in this scope
242 | void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
| ^
p1553.cpp:242:73: error: expected primary-expression before ',' token
242 | void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
| ^
p1553.cpp:242:81: error: expected primary-expression before '>' token
242 | void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
| ^
p1553.cpp:242:84: error: 'y' was not declared in this scope; did you mean 'yn'?
242 | void swap(basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y);
| ^
| yn
p1553.cpp:245:1: error: 'basic_spanbuf' does not name a type
245 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~~~~~~
p1553.cpp:247:1: error: expected unqualified-id before 'return'
247 | return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
| ^~~~~~
p1553.cpp:248:6: error: 'span' in namespace 'std' does not name a template type
248 | std::span<charT> span() const noexcept;
| ^~~~
p1553.cpp:254:59: error: spurious '>>', use '>' to terminate a template argument list
254 | template<class charT, class traits = char_traits<charT>>
| ^~
p1553.cpp:256:38: error: 'traits' was not declared in this scope
256 | : public basic_iostream<charT, traits> {
| ^~~~~~
p1553.cpp:256:44: error: template argument 2 is invalid
256 | : public basic_iostream<charT, traits> {
| ^
p1553.cpp:256:46: error: definition of 'class std::basic_spanstream' inside template parameter list
256 | : public basic_iostream<charT, traits> {
| ^
p1553.cpp:254:42: error: two or more data types in declaration of 'type name'
254 | template<class charT, class traits = char_traits<charT>>
| ^~~~~~~~~~~~~~~~~~~
p1553.cpp:258:2: error: expected '>' before ';' token
258 | };
| ^
p1553.cpp:258:2: error: expected unqualified-id before ';' token
p1553.cpp:259:7: error: expected nested-name-specifier before 'char_type'
259 | using char_type = charT;
| ^~~~~~~~~
p1553.cpp:260:7: error: expected nested-name-specifier before 'int_type'
260 | using int_type = typename traits::int_type;
| ^~~~~~~~
p1553.cpp:261:7: error: expected nested-name-specifier before 'pos_type'
261 | using pos_type = typename traits::pos_type;
| ^~~~~~~~
p1553.cpp:262:7: error: expected nested-name-specifier before 'off_type'
262 | using off_type = typename traits::off_type;
| ^~~~~~~~
p1553.cpp:263:7: error: expected nested-name-specifier before 'traits_type'
263 | using traits_type = traits;
| ^~~~~~~~~~~
p1553.cpp:265:10: error: ISO C++ forbids declaration of 'basic_spanstream' with no type [-fpermissive]
265 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~~~~~~~~~~~~
p1553.cpp:265:1: error: 'explicit' outside class declaration
265 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~~~~
p1553.cpp:265:32: error: 'span' is not a member of 'std'
265 | explicit basic_spanstream(std::span<charT> s,
| ^~~~
p1553.cpp:265:37: error: 'charT' was not declared in this scope; did you mean 'char'?
265 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~
| char
p1553.cpp:265:44: error: 's' was not declared in this scope; did you mean 'ws'?
265 | explicit basic_spanstream(std::span<charT> s,
| ^
| ws
p1553.cpp:266:48: error: expected primary-expression before 'which'
266 | ios_base::openmode which = ios_base::out | ios_base::in);
| ^~~~~
p1553.cpp:266:84: error: expression list treated as compound expression in initializer [-fpermissive]
266 | ios_base::openmode which = ios_base::out | ios_base::in);
| ^
p1553.cpp:267:26: error: 'basic_spanstream' does not name a type; did you mean 'basic_ostream'?
267 | basic_spanstream(const basic_spanstream&) = delete;
| ^~~~~~~~~~~~~~~~
| basic_ostream
p1553.cpp:267:45: error: expected constructor, destructor, or type conversion before '=' token
267 | basic_spanstream(const basic_spanstream&) = delete;
| ^
p1553.cpp:268:19: error: expected constructor, destructor, or type conversion before '(' token
268 | basic_spanstream(basic_spanstream&& rhs);
| ^
p1553.cpp:269:3: error: 'basic_spanstream' does not name a type; did you mean 'basic_ostream'?
269 | basic_spanstream& operator=(const basic_spanstream&) = delete;
| ^~~~~~~~~~~~~~~~
| basic_ostream
p1553.cpp:270:3: error: 'basic_spanstream' does not name a type; did you mean 'basic_ostream'?
270 | basic_spanstream& operator=(basic_spanstream&& rhs);
| ^~~~~~~~~~~~~~~~
| basic_ostream
p1553.cpp:272:6: error: variable or field 'swap' declared void
272 | void swap(basic_spanstream& rhs);
| ^~~~
p1553.cpp:272:29: error: 'rhs' was not declared in this scope
272 | void swap(basic_spanstream& rhs);
| ^~~
p1553.cpp:274:1: error: 'basic_spanbuf' does not name a type; did you mean 'basic_streambuf'?
274 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~~~~~~
| basic_streambuf
p1553.cpp:275:8: error: 'span' in namespace 'std' does not name a template type
275 | std::span<charT> span() const noexcept;
| ^~~~
p1553.cpp:276:8: error: variable or field 'span' declared void
276 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:276:18: error: 'span' is not a member of 'std'
276 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:276:23: error: 'charT' was not declared in this scope; did you mean 'char'?
276 | void span(std::span<charT> s) noexcept;
| ^~~~~
| char
p1553.cpp:276:30: error: 's' was not declared in this scope; did you mean 'ws'?
276 | void span(std::span<charT> s) noexcept;
| ^
| ws
p1553.cpp:277:1: error: expected unqualified-id before 'private'
277 | private:
| ^~~~~~~
p1553.cpp:280:8: error: variable or field 'swap' declared void
280 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^~~~
p1553.cpp:280:35: error: expected primary-expression before ',' token
280 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:280:43: error: expected primary-expression before '>' token
280 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:280:46: error: 'x' was not declared in this scope
280 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:280:71: error: expected primary-expression before ',' token
280 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:280:79: error: expected primary-expression before '>' token
280 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:280:82: error: 'y' was not declared in this scope; did you mean 'yn'?
280 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
| yn
p1553.cpp:282:10: error: ISO C++ forbids declaration of 'basic_spanstream' with no type [-fpermissive]
282 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~~~~~~~~~~~~
p1553.cpp:282:1: error: 'explicit' outside class declaration
282 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~~~~
p1553.cpp:282:10: error: redefinition of 'int std::basic_spanstream'
282 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~~~~~~~~~~~~
p1553.cpp:265:10: note: 'int std::basic_spanstream' previously defined here
265 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~~~~~~~~~~~~
p1553.cpp:282:32: error: 'span' is not a member of 'std'
282 | explicit basic_spanstream(std::span<charT> s,
| ^~~~
p1553.cpp:282:37: error: 'charT' was not declared in this scope; did you mean 'char'?
282 | explicit basic_spanstream(std::span<charT> s,
| ^~~~~
| char
p1553.cpp:282:44: error: 's' was not declared in this scope; did you mean 'ws'?
282 | explicit basic_spanstream(std::span<charT> s,
| ^
| ws
p1553.cpp:283:46: error: expected primary-expression before 'which'
283 | ios_base::openmode which = ios_base::out | ios_bas::in);
| ^~~~~
p1553.cpp:285:17: error: expected constructor, destructor, or type conversion before '(' token
285 | basic_spanstream(basic_spanstream&& rhs);
| ^
p1553.cpp:288:6: error: variable or field 'swap' declared void
288 | void swap(basic_spanstream& rhs);
| ^~~~
p1553.cpp:288:29: error: 'rhs' was not declared in this scope
288 | void swap(basic_spanstream& rhs);
| ^~~
p1553.cpp:290:16: error: 'charT' was not declared in this scope; did you mean 'char'?
290 | basic_iostream<charT, traits>::swap(rhs);
| ^~~~~
| char
p1553.cpp:290:23: error: 'traits' was not declared in this scope
290 | basic_iostream<charT, traits>::swap(rhs);
| ^~~~~~
p1553.cpp:290:29: error: template argument 1 is invalid
290 | basic_iostream<charT, traits>::swap(rhs);
| ^
p1553.cpp:290:29: error: template argument 2 is invalid
p1553.cpp:290:40: error: 'int std::swap' redeclared as different kind of entity
290 | basic_iostream<charT, traits>::swap(rhs);
| ^
In file included from /usr/local/include/c++/12.1.0/map:62,
from N4910.h:10:
/usr/local/include/c++/12.1.0/bits/stl_multimap.h:1206:5: note: previous declaration 'template<class _Key, class _Tp, class _Compare, class _Alloc> void std::swap(multimap<_Key, _Tp, _Compare, _Alloc>&, multimap<_Key, _Tp, _Compare, _Alloc>&)'
1206 | swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~
p1553.cpp:290:37: error: 'rhs' was not declared in this scope
290 | basic_iostream<charT, traits>::swap(rhs);
| ^~~
p1553.cpp:291:3: error: 'sb' does not name a type
291 | sb.swap(rhs.sb);
| ^~
p1553.cpp:293:8: error: variable or field 'swap' declared void
293 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^~~~
p1553.cpp:293:35: error: expected primary-expression before ',' token
293 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:293:43: error: expected primary-expression before '>' token
293 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:293:46: error: 'x' was not declared in this scope
293 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:293:71: error: expected primary-expression before ',' token
293 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:293:79: error: expected primary-expression before '>' token
293 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
p1553.cpp:293:82: error: 'y' was not declared in this scope; did you mean 'yn'?
293 | void swap(basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y);
| ^
| yn
p1553.cpp:296:1: error: 'basic_spanbuf' does not name a type; did you mean 'basic_streambuf'?
296 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~~~~~~
| basic_streambuf
p1553.cpp:298:1: error: expected unqualified-id before 'return'
298 | return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
| ^~~~~~
p1553.cpp:299:6: error: 'span' in namespace 'std' does not name a template type
299 | std::span<charT> span() const noexcept;
| ^~~~
$ g++ p1553.cpp -std=2b -o p1553g -I. -Wall
p1553.cpp:16:51: error: too many decimal points in number
16 | types are specializations of span as described in 24.7.3.
| ^~~~~~~
p1553.cpp:16:1: error: 'types' does not name a type
16 | types are specializations of span as described in 24.7.3.
| ^~~~~
p1553.cpp:53:33: error: expected ')' before '<' token
53 | explicit basic_spanbuf(std::span<charT> s,
| ~ ^
| )
p1553.cpp: In constructor 'std::basic_spanbuf<charT, traits>::basic_spanbuf(std::ios_base::openmode)':
p1553.cpp:52:24: error: 'span' is not a member of 'std'
52 | : basic_spanbuf(std::span<charT>(), which) {}
| ^~~~
p1553.cpp:52:34: error: expected primary-expression before '>' token
52 | : basic_spanbuf(std::span<charT>(), which) {}
| ^
p1553.cpp:52:36: error: expected primary-expression before ')' token
52 | : basic_spanbuf(std::span<charT>(), which) {}
| ^
p1553.cpp: At global scope:
p1553.cpp:77:33: error: expected ')' before '<' token
77 | explicit basic_spanbuf(std::span<charT> s,
| ~ ^
| )
p1553.cpp:80:21: error: template placeholder type 'basic_spanbuf<...auto...>' must be followed by a simple declarator-id
80 | basic_spanbuf(basic_spanbuf&& rhs);
| ^~~~~~~~~~~~~
p1553.cpp:42:11: note: 'template<class charT, class traits> class std::basic_spanbuf' declared here
42 | class basic_spanbuf
| ^~~~~~~~~~~~~
p1553.cpp:80:7: error: deduction guide for 'std::basic_spanbuf<charT, traits>' must have trailing return type
80 | basic_spanbuf(basic_spanbuf&& rhs);
| ^~~~~~~~~~~~~
p1553.cpp:42:11: note: 'template<class charT, class traits> class std::basic_spanbuf' declared here
42 | class basic_spanbuf
| ^~~~~~~~~~~~~
p1553.cpp:89:26: error: template placeholder type 'basic_spanbuf<...auto...>' must be followed by a simple declarator-id
89 | basic_spanbuf& operator=(basic_spanbuf&& rhs);
| ^~~~~~~~~~~~~
p1553.cpp:42:11: note: 'template<class charT, class traits> class std::basic_spanbuf' declared here
42 | class basic_spanbuf
| ^~~~~~~~~~~~~
p1553.cpp:89:1: error: deduced class type 'basic_spanbuf' in function return type
89 | basic_spanbuf& operator=(basic_spanbuf&& rhs);
| ^~~~~~~~~~~~~
p1553.cpp:42:11: note: 'template<class charT, class traits> class std::basic_spanbuf' declared here
42 | class basic_spanbuf
| ^~~~~~~~~~~~~
p1553.cpp:91:31: error: 'rhs' was not declared in this scope
91 | basic_spanbuf tmp{std::move(rhs)};
| ^~~
p1553.cpp:92:3: error: expected unqualified-id before 'this'
92 | this->swap(tmp);
| ^~~~
p1553.cpp:93:3: error: expected unqualified-id before 'return'
93 | return *this;
| ^~~~~~
p1553.cpp:94:11: error: template placeholder type 'basic_spanbuf<...auto...>' must be followed by a simple declarator-id
94 | void swap(basic_spanbuf& rhs);
| ^~~~~~~~~~~~~
p1553.cpp:42:11: note: 'template<class charT, class traits> class std::basic_spanbuf' declared here
42 | class basic_spanbuf
| ^~~~~~~~~~~~~
p1553.cpp:96:17: error: 'charT' was not declared in this scope; did you mean 'char'?
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~~~
| char
p1553.cpp:96:24: error: 'traits' was not declared in this scope
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~~~~
p1553.cpp:96:30: error: template argument 1 is invalid
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^
p1553.cpp:96:30: error: template argument 2 is invalid
p1553.cpp:96:41: error: 'int swap' redeclared as different kind of entity
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^
p1553.cpp:94:6: note: previous declaration 'void swap(...)'
94 | void swap(basic_spanbuf& rhs);
| ^~~~
p1553.cpp:96:38: error: 'rhs' was not declared in this scope
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^~~
p1553.cpp:96:53: error: expected constructor, destructor, or type conversion before '(' token
96 | basic_streambuf<charT, traits>::swap(rhs); std::swap(mode, rhs.mode);
| ^
p1553.cpp:97:10: error: expected constructor, destructor, or type conversion before '(' token
97 | std::swap(buf, rhs.buf);
| ^
p1553.cpp:102:6: error: 'span' in namespace 'std' does not name a template type
102 | std::span<charT> span() const noexcept;
| ^~~~
p1553.cpp:105:6: error: variable or field 'span' declared void
105 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:105:16: error: 'span' is not a member of 'std'
105 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:105:21: error: 'charT' was not declared in this scope; did you mean 'char'?
105 | void span(std::span<charT> s) noexcept;
| ^~~~~
| char
p1553.cpp:105:28: error: 's' was not declared in this scope
105 | void span(std::span<charT> s) noexcept;
| ^
p1553.cpp:108:9: error: expected constructor, destructor, or type conversion before '==' token
108 | pbase() == s.data() && epptr() == pbase() + s.size() is true;
| ^~
p1553.cpp:122:1: error: 'off_type' does not name a type; did you mean 'off_t'?
122 | off_type newoff = baseoff + off;
| ^~~~~~~~
| off_t
p1553.cpp:127:4: error: 'pos_type' does not name a type
127 | pos_type seekoff(off_type off, ios_base::seekdir way,
| ^~~~~~~~
p1553.cpp:129:1: error: 'pos_type' does not name a type
129 | pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;
| ^~~~~~~~
p1553.cpp:131:1: error: expected unqualified-id before 'return'
131 | return seekoff(off_type(sp), ios_base::beg, which);
| ^~~~~~
p1553.cpp:132:17: error: 'charT' was not declared in this scope; did you mean 'char'?
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~
| char
p1553.cpp:132:24: error: 'traits' was not declared in this scope
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~~
p1553.cpp:132:30: error: template argument 1 is invalid
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^
p1553.cpp:132:30: error: template argument 2 is invalid
p1553.cpp:132:40: error: 'int* setbuf' redeclared as different kind of entity
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~
In file included from /usr/local/include/c++/12.1.0/cstdio:42,
from /usr/local/include/c++/12.1.0/ext/string_conversions.h:43,
from /usr/local/include/c++/12.1.0/bits/basic_string.h:3960,
from /usr/local/include/c++/12.1.0/string:53,
from /usr/local/include/c++/12.1.0/bits/locale_classes.h:40,
from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
from /usr/local/include/c++/12.1.0/ios:42,
from /usr/local/include/c++/12.1.0/ostream:38,
from /usr/local/include/c++/12.1.0/iostream:39,
from N4910.h:2,
from p1553.cpp:10:
/usr/include/stdio.h:304:13: note: previous declaration 'void setbuf(FILE*, char*)'
304 | extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
| ^~~~~~
p1553.cpp:132:40: error: 'charT' was not declared in this scope; did you mean 'char'?
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^~~~~
| char
p1553.cpp:132:47: error: 's' was not declared in this scope
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^
p1553.cpp:132:61: error: expected primary-expression before 'n'
132 | basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;
| ^
p1553.cpp:134:1: error: expected unqualified-id before 'this'
134 | this->span(std::span<charT>(s, n));
| ^~~~
p1553.cpp:135:1: error: expected unqualified-id before 'return'
135 | return this;
| ^~~~~~
p1553.cpp:149:37: error: expected ')' before '<' token
149 | explicit basic_ispanstream(std::span<charT> s,
| ~ ^
| )
p1553.cpp:154:1: error: 'Effects' does not name a type
154 | Effects: Initializes the base class with basic_istream<charT, traits>(addressof(sb)) and sb with basic_spanbuf<charT, traits>(s, which | ios_base::in)
| ^~~~~~~
p1553.cpp:161:15: error: 'span' in namespace 'std' does not name a template type
161 | std::span<const charT> span() const noexcept;
| ^~~~
p1553.cpp:162:20: error: 'std::span' has not been declared
162 | void span(std::span<charT> s) noexcept;
| ^~~
p1553.cpp:162:29: error: expected ',' or '...' before '<' token
162 | void span(std::span<charT> s) noexcept;
| ^
p1553.cpp:171:1: error: 'spanbuf' does not name a type
171 | spanbuf.
| ^~~~~~~
p1553.cpp:174:19: error: template placeholder type 'basic_ispanstream<...auto...>' must be followed by a simple declarator-id
174 | basic_ispanstream(basic_ispanstream&& rhs);
| ^~~~~~~~~~~~~~~~~
p1553.cpp:140:11: note: 'template<class charT, class traits> class std::basic_ispanstream' declared here
140 | class basic_ispanstream
| ^~~~~~~~~~~~~~~~~
p1553.cpp:174:1: error: deduction guide for 'std::basic_ispanstream<charT, traits>' must have trailing return type
174 | basic_ispanstream(basic_ispanstream&& rhs);
| ^~~~~~~~~~~~~~~~~
p1553.cpp:140:11: note: 'template<class charT, class traits> class std::basic_ispanstream' declared here
140 | class basic_ispanstream
| ^~~~~~~~~~~~~~~~~
p1553.cpp:180:1: error: expected initializer before 'void'
180 | void swap(basic_ispanstream& rhs);
| ^~~~
p1553.cpp:182:15: error: 'charT' was not declared in this scope; did you mean 'char'?
182 | basic_istream<charT, traits>::swap(rhs);
| ^~~~~
| char
p1553.cpp:182:22: error: 'traits' was not declared in this scope
182 | basic_istream<charT, traits>::swap(rhs);
| ^~~~~~
p1553.cpp:182:28: error: template argument 1 is invalid
182 | basic_istream<charT, traits>::swap(rhs);
| ^
p1553.cpp:182:28: error: template argument 2 is invalid
p1553.cpp:182:39: error: 'int swap' redeclared as different kind of entity
182 | basic_istream<charT, traits>::swap(rhs);
| ^
p1553.cpp:99:8: note: previous declaration 'template<class charT, class traits> void swap(std::basic_spanbuf<charT, traits>&, std::basic_spanbuf<charT, traits>&)'
99 | void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
| ^~~~
p1553.cpp:182:36: error: 'rhs' was not declared in this scope
182 | basic_istream<charT, traits>::swap(rhs);
| ^~~
p1553.cpp:183:3: error: 'sb' does not name a type
183 | sb.swap(rhs.sb);
| ^~
p1553.cpp:188:15: error: 'charT' was not declared in this scope; did you mean 'char'?
188 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~
| char
p1553.cpp:188:22: error: 'traits' was not declared in this scope
188 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~
p1553.cpp:188:28: error: template argument 1 is invalid
188 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^
p1553.cpp:188:28: error: template argument 2 is invalid
p1553.cpp:188:45: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
188 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~
p1553.cpp:190:1: error: expected unqualified-id before 'return'
190 | return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
| ^~~~~~
p1553.cpp:191:6: error: 'span' in namespace 'std' does not name a template type
191 | std::span<const charT> span() const noexcept;
| ^~~~
p1553.cpp:193:1: error: expected unqualified-id before 'return'
193 | return rdbuf()->span();
| ^~~~~~
p1553.cpp:194:6: error: variable or field 'span' declared void
194 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:194:16: error: 'span' is not a member of 'std'
194 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:194:21: error: 'charT' was not declared in this scope; did you mean 'char'?
194 | void span(std::span<charT> s) noexcept;
| ^~~~~
| char
p1553.cpp:194:28: error: 's' was not declared in this scope
194 | void span(std::span<charT> s) noexcept;
| ^
p1553.cpp:213:37: error: expected ')' before '<' token
213 | explicit basic_ospanstream(std::span<charT> s,
| ~ ^
| )
p1553.cpp:223:8: error: 'span' in namespace 'std' does not name a template type
223 | std::span<charT> span() const noexcept;
| ^~~~
p1553.cpp:224:13: error: 'std::span' has not been declared
224 | void span(std::span<charT> s) noexcept;
| ^~~
p1553.cpp:224:22: error: expected ',' or '...' before '<' token
224 | void span(std::span<charT> s) noexcept;
| ^
p1553.cpp:227:10: error: declaration of template parameter 'charT' shadows template parameter
227 | template<class charT, class traits>
| ^~~~~
p1553.cpp:203:14: note: template parameter 'charT' declared here
203 | template<class charT, class traits = char_traits<charT>>
| ^~~~~
p1553.cpp:227:23: error: declaration of template parameter 'traits' shadows template parameter
227 | template<class charT, class traits>
| ^~~~~
p1553.cpp:203:27: note: template parameter 'traits' declared here
203 | template<class charT, class traits = char_traits<charT>>
| ^~~~~
p1553.cpp:232:37: error: expected ')' before '<' token
232 | explicit basic_ospanstream(std::span<charT> s,
| ~ ^
| )
p1553.cpp:234:19: error: template placeholder type 'basic_ospanstream<...auto...>' must be followed by a simple declarator-id
234 | basic_ospanstream(basic_ospanstream&& rhs) noexcept;
| ^~~~~~~~~~~~~~~~~
p1553.cpp:204:11: note: 'template<class charT, class traits> class std::basic_ospanstream' declared here
204 | class basic_ospanstream
| ^~~~~~~~~~~~~~~~~
p1553.cpp:234:1: error: deduction guide for 'std::basic_ospanstream<charT, traits>' must have trailing return type
234 | basic_ospanstream(basic_ospanstream&& rhs) noexcept;
| ^~~~~~~~~~~~~~~~~
p1553.cpp:204:11: note: 'template<class charT, class traits> class std::basic_ospanstream' declared here
204 | class basic_ospanstream
| ^~~~~~~~~~~~~~~~~
p1553.cpp:237:14: error: template placeholder type 'basic_ospanstream<...auto...>' must be followed by a simple declarator-id
237 | void swap(basic_ospanstream& rhs);
| ^~~~~~~~~~~~~~~~~
p1553.cpp:204:11: note: 'template<class charT, class traits> class std::basic_ospanstream' declared here
204 | class basic_ospanstream
| ^~~~~~~~~~~~~~~~~
p1553.cpp:239:15: error: 'charT' was not declared in this scope; did you mean 'char'?
239 | basic_ostream<charT, traits>::swap(rhs);
| ^~~~~
| char
p1553.cpp:239:22: error: 'traits' was not declared in this scope
239 | basic_ostream<charT, traits>::swap(rhs);
| ^~~~~~
p1553.cpp:239:28: error: template argument 1 is invalid
239 | basic_ostream<charT, traits>::swap(rhs);
| ^
p1553.cpp:239:28: error: template argument 2 is invalid
p1553.cpp:239:39: error: 'int swap' redeclared as different kind of entity
239 | basic_ostream<charT, traits>::swap(rhs);
| ^
p1553.cpp:185:8: note: previous declaration 'template<class charT, class traits> void swap(std::basic_ispanstream<charT, traits>&, std::basic_ispanstream<charT, traits>&)'
185 | void swap(basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y);
| ^~~~
p1553.cpp:239:36: error: 'rhs' was not declared in this scope
239 | basic_ostream<charT, traits>::swap(rhs);
| ^~~
p1553.cpp:240:3: error: 'sb' does not name a type
240 | sb.swap(rhs.sb);
| ^~
p1553.cpp:245:15: error: 'charT' was not declared in this scope; did you mean 'char'?
245 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~
| char
p1553.cpp:245:22: error: 'traits' was not declared in this scope
245 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~
p1553.cpp:245:28: error: template argument 1 is invalid
245 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^
p1553.cpp:245:28: error: template argument 2 is invalid
p1553.cpp:245:45: error: non-member function 'int* rdbuf()' cannot have cv-qualifier
245 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~
p1553.cpp:247:1: error: expected unqualified-id before 'return'
247 | return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
| ^~~~~~
p1553.cpp:248:6: error: 'span' in namespace 'std' does not name a template type
248 | std::span<charT> span() const noexcept;
| ^~~~
p1553.cpp:259:19: error: 'charT' does not name a type; did you mean 'char'?
259 | using char_type = charT;
| ^~~~~
| char
p1553.cpp:260:27: error: 'traits' has not been declared
260 | using int_type = typename traits::int_type;
| ^~~~~~
p1553.cpp:261:27: error: 'traits' has not been declared
261 | using pos_type = typename traits::pos_type;
| ^~~~~~
p1553.cpp:262:27: error: 'traits' has not been declared
262 | using off_type = typename traits::off_type;
| ^~~~~~
p1553.cpp:263:21: error: 'traits' does not name a type
263 | using traits_type = traits;
| ^~~~~~
p1553.cpp:265:36: error: expected ')' before '<' token
265 | explicit basic_spanstream(std::span<charT> s,
| ~ ^
| )
p1553.cpp:267:20: error: class template placeholder 'std::basic_spanstream' not permitted in this context
267 | basic_spanstream(const basic_spanstream&) = delete;
| ^~~~~
p1553.cpp:267:20: note: use 'auto' for an abbreviated function template
p1553.cpp:267:3: error: deduction guide for 'std::basic_spanstream<charT, traits>' must have trailing return type
267 | basic_spanstream(const basic_spanstream&) = delete;
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:268:20: error: template placeholder type 'basic_spanstream<...auto...>' must be followed by a simple declarator-id
268 | basic_spanstream(basic_spanstream&& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:268:3: error: deduction guide for 'std::basic_spanstream<charT, traits>' must have trailing return type
268 | basic_spanstream(basic_spanstream&& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:269:31: error: class template placeholder 'std::basic_spanstream' not permitted in this context
269 | basic_spanstream& operator=(const basic_spanstream&) = delete;
| ^~~~~
p1553.cpp:269:31: note: use 'auto' for an abbreviated function template
p1553.cpp:269:3: error: deduced class type 'basic_spanstream' in function return type
269 | basic_spanstream& operator=(const basic_spanstream&) = delete;
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:270:31: error: template placeholder type 'basic_spanstream<...auto...>' must be followed by a simple declarator-id
270 | basic_spanstream& operator=(basic_spanstream&& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:270:3: error: deduced class type 'basic_spanstream' in function return type
270 | basic_spanstream& operator=(basic_spanstream&& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:272:11: error: template placeholder type 'basic_spanstream<...auto...>' must be followed by a simple declarator-id
272 | void swap(basic_spanstream& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:274:15: error: 'charT' was not declared in this scope; did you mean 'char'?
274 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~
| char
p1553.cpp:274:22: error: 'traits' was not declared in this scope
274 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~
p1553.cpp:274:28: error: template argument 1 is invalid
274 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^
p1553.cpp:274:28: error: template argument 2 is invalid
p1553.cpp:274:45: error: non-member function 'int* std::rdbuf()' cannot have cv-qualifier
274 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~
p1553.cpp:275:8: error: 'span' in namespace 'std' does not name a template type
275 | std::span<charT> span() const noexcept;
| ^~~~
p1553.cpp:276:8: error: variable or field 'span' declared void
276 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:276:18: error: 'span' is not a member of 'std'; did you mean 'span'?
276 | void span(std::span<charT> s) noexcept;
| ^~~~
p1553.cpp:196:26: note: 'span' declared here
196 | template<class ROS> void span(ROS&& s) noexcept;
| ^~~~
p1553.cpp:276:23: error: 'charT' was not declared in this scope; did you mean 'char'?
276 | void span(std::span<charT> s) noexcept;
| ^~~~~
| char
p1553.cpp:276:30: error: 's' was not declared in this scope; did you mean 'ws'?
276 | void span(std::span<charT> s) noexcept;
| ^
| ws
p1553.cpp:277:1: error: expected unqualified-id before 'private'
277 | private:
| ^~~~~~~
p1553.cpp:282:36: error: expected ')' before '<' token
282 | explicit basic_spanstream(std::span<charT> s,
| ~ ^
| )
p1553.cpp:285:18: error: template placeholder type 'basic_spanstream<...auto...>' must be followed by a simple declarator-id
285 | basic_spanstream(basic_spanstream&& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:285:1: error: deduction guide for 'std::basic_spanstream<charT, traits>' must have trailing return type
285 | basic_spanstream(basic_spanstream&& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:288:11: error: template placeholder type 'basic_spanstream<...auto...>' must be followed by a simple declarator-id
288 | void swap(basic_spanstream& rhs);
| ^~~~~~~~~~~~~~~~
p1553.cpp:255:11: note: 'template<class charT, class traits> class std::basic_spanstream' declared here
255 | class basic_spanstream
| ^~~~~~~~~~~~~~~~
p1553.cpp:290:16: error: 'charT' was not declared in this scope; did you mean 'char'?
290 | basic_iostream<charT, traits>::swap(rhs);
| ^~~~~
| char
p1553.cpp:290:23: error: 'traits' was not declared in this scope
290 | basic_iostream<charT, traits>::swap(rhs);
| ^~~~~~
p1553.cpp:290:29: error: template argument 1 is invalid
290 | basic_iostream<charT, traits>::swap(rhs);
| ^
p1553.cpp:290:29: error: template argument 2 is invalid
p1553.cpp:290:40: error: 'int std::swap' redeclared as different kind of entity
290 | basic_iostream<charT, traits>::swap(rhs);
| ^
In file included from /usr/local/include/c++/12.1.0/vector:65,
from N4910.h:8:
/usr/local/include/c++/12.1.0/bits/stl_bvector.h:132:5: note: previous declaration 'constexpr void std::swap(_Bit_reference, _Bit_reference)'
132 | swap(_Bit_reference __x, _Bit_reference __y) noexcept
| ^~~~
p1553.cpp:290:37: error: 'rhs' was not declared in this scope
290 | basic_iostream<charT, traits>::swap(rhs);
| ^~~
p1553.cpp:291:3: error: 'sb' does not name a type
291 | sb.swap(rhs.sb);
| ^~
p1553.cpp:296:15: error: 'charT' was not declared in this scope; did you mean 'char'?
296 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~
| char
p1553.cpp:296:22: error: 'traits' was not declared in this scope
296 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~
p1553.cpp:296:28: error: template argument 1 is invalid
296 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^
p1553.cpp:296:28: error: template argument 2 is invalid
p1553.cpp:296:45: error: non-member function 'int* std::rdbuf()' cannot have cv-qualifier
296 | basic_spanbuf<charT, traits>* rdbuf() const noexcept;
| ^~~~~~~~
p1553.cpp:298:1: error: expected unqualified-id before 'return'
298 | return const_cast<basic_spanbuf<charT, traits>*>(addressof(sb));
| ^~~~~~
p1553.cpp:299:6: error: 'span' in namespace 'std' does not name a template type
299 | std::span<charT> span() const noexcept;
| ^~~~
検討事項(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 初稿 20220827