LoginSignup
0
0

More than 1 year has passed since last update.

31.3 Forward declarations [iostream.forward] C++N4910:2022 (686) p1488.cpp

Posted at

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

C++ n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 のWG21を含むいくつかのWGでは、可能な限り作業文書を公開し、幅広い意見を求めています。

ISO/IEC JTC1 SC7からISO/IEC JTC1 SC22リエゾンとして、2000年頃、C/C++の品質向上に貢献しようとした活動をしていたことがあります。その頃は、まだISO/IEC TS 17961の原案が出る前です。Cの精神が優勢で、セキュリティ対策は補助的な位置付けでした。ISO/IEC TS 17961の制定と、C/C++のライブラリ類の見直しと、C++の進化はどんどん進んでいきます。 

進化の具合が、どちらに行こうとしているかは、コンパイルて実行させてみないとわかりません。C/C++の規格案の電子ファイルは、そのままコンパイルできる形式であるとよいと主張してきました。MISRA-C/C++, CERTC/C++でも同様です。MISRA-C/C++は、Example Suiteという形で、コード断片をコンパイルできる形で提供するようになりました。

一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, 箱庭プロジェクト、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

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

背景(back ground)

C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を10種類以上、最近になって解決できたことがあります。それは、主に次の3つの情報に基づいています。

cpprefjp - C++日本語リファレンス

コンパイラの実装状況

また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。

作業方針(sequence)

Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、

1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list

C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list

C++N4606, 2016符号断片編纂一覧(example code compile list)

C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

C++N3242, 2011 sample code compile list on clang++ and g++

編纂器(Compiler)

clang++ --version

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

g++- --version

g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

31.3 Forward declarations [iostream.forward] C++N4910:2022 (686) p1488.cpp

算譜(source code)

p1488.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.3 Forward declarations [iostream.forward] C++N4910:2022 (686) p1488.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.3.1 Header <iosfwd> synopsis  [iosfwd.syn]
  namespace std {
    template<class charT> struct char_traits;
    template<> struct char_traits<char>;
    template<> struct char_traits<char8_t>;
    template<> struct char_traits<char16_t>;
    template<> struct char_traits<char32_t>;
    template<> struct char_traits<wchar_t>;
    template<class T> class allocator;
    template<class charT, class traits = char_traits<charT>>
      class basic_ios;
    template<class charT, class traits = char_traits<charT>>
      class basic_streambuf;
    template<class charT, class traits = char_traits<charT>>
      class basic_istream;
    template<class charT, class traits = char_traits<charT>>
      class basic_ostream;
    template<class charT, class traits = char_traits<charT>>
      class basic_iostream;
    template<class charT, class traits = char_traits<charT>,
             class Allocator = allocator<charT>>
      class basic_stringbuf;
    template<class charT, class traits = char_traits<charT>,
             class Allocator = allocator<charT>>
      class basic_istringstream;
    template<class charT, class traits = char_traits<charT>,
             class Allocator = allocator<charT>>
      class basic_ostringstream;
    template<class charT, class traits = char_traits<charT>,
             class Allocator = allocator<charT>>
      class basic_stringstream;
    template<class charT, class traits = char_traits<charT>>
      class basic_spanbuf;
    template<class charT, class traits = char_traits<charT>>
      class basic_ispanstream;
    template<class charT, class traits = char_traits<charT>>
      class basic_ospanstream;
    template<class charT, class traits = char_traits<charT>>
      class basic_spanstream;
    template<class charT, class traits = char_traits<charT>>
      class basic_filebuf;
    template<class charT, class traits = char_traits<charT>>
      class basic_ifstream;
    template<class charT, class traits = char_traits<charT>>
      class basic_ofstream;
    template<class charT, class traits = char_traits<charT>>
      class basic_fstream;
template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<charT>>
  class basic_syncbuf;
template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<charT>>
  class basic_osyncstream;
template<class charT, class traits = char_traits<charT>>
  class istreambuf_iterator;
template<class charT, class traits = char_traits<charT>>
  class ostreambuf_iterator;
using ios  = basic_ios<char>;
using wios = basic_ios<wchar_t>;
using streambuf = basic_streambuf<char>;
using istream   = basic_istream<char>;
using ostream   = basic_ostream<char>;
using iostream  = basic_iostream<char>;
using stringbuf     = basic_stringbuf<char>;
using istringstream = basic_istringstream<char>;
using ostringstream = basic_ostringstream<char>;
using stringstream  = basic_stringstream<char>;
using spanbuf     = basic_spanbuf<char>;
using ispanstream = basic_ispanstream<char>;
using ospanstream = basic_ospanstream<char>;
using spanstream  = basic_spanstream<char>;
using filebuf  = basic_filebuf<char>;
using ifstream = basic_ifstream<char>;
using ofstream = basic_ofstream<char>;
using fstream  = basic_fstream<char>;
using syncbuf = basic_syncbuf<char>;
using osyncstream = basic_osyncstream<char>;
using wstreambuf = basic_streambuf<wchar_t>;
using wistream   = basic_istream<wchar_t>;
using wostream   = basic_ostream<wchar_t>;
using wiostream  = basic_iostream<wchar_t>;
using wstringbuf     = basic_stringbuf<wchar_t>;
using wistringstream = basic_istringstream<wchar_t>;
using wostringstream = basic_ostringstream<wchar_t>;
using wstringstream  = basic_stringstream<wchar_t>;
using wspanbuf     = basic_spanbuf<wchar_t>;
using wispanstream = basic_ispanstream<wchar_t>;
using wospanstream = basic_ospanstream<wchar_t>;
using wspanstream  = basic_spanstream<wchar_t>;
using wfilebuf  = basic_filebuf<wchar_t>;
using wifstream = basic_ifstream<wchar_t>;
using wofstream = basic_ofstream<wchar_t>;
using wfstream  = basic_fstream<wchar_t>;
using wsyncbuf = basic_syncbuf<wchar_t>;
using wosyncstream = basic_osyncstream<wchar_t>;
template<class state> class fpos;
using streampos  = fpos<char_traits<char>::state_type>;
using wstreampos = fpos<char_traits<wchar_t>::state_type>;
using u8streampos = fpos<char_traits<char8_t>::state_type>;
using u16streampos = fpos<char_traits<char16_t>::state_type>;
using u32streampos = fpos<char_traits<char32_t>::state_type>;
}
//  Default template arguments are described as appearing both in <iosfwd> and in the synopsis of other headers but it is well-formed to include both <iosfwd> and one or more of the other headers.273
// 31.3.2 Overview [iostream.forward.overview]
//  The class template specialization basic_ios<charT, traits> serves as a virtual base class for the class templates basic_istream, basic_ostream, and class templates derived from them. basic_iostream is a class template derived from both basic_istream<charT, traits> and basic_ostream<charT, traits>.
//  The class template specialization basic_streambuf<charT, traits> serves as a base class for class templates basic_stringbuf, basic_filebuf, and basic_syncbuf.
//  The class template specialization basic_istream<charT, traits> serves as a base class for class templates basic_istringstream and basic_ifstream.
//  The class template specialization basic_ostream<charT, traits> serves as a base class for class templates basic_ostringstream, basic_ofstream, and basic_osyncstream.
//  The class template specialization basic_iostream<charT, traits> serves as a base class for class templates basic_stringstream and basic_fstream.
//  [Note 1: For each of the class templates above, the program is ill-formed if traits::char_type is not the same type as charT (23.2). 
//  Other typedef-names define instances of class templates specialized for char or wchar_t types.
//  Specializations of the class template fpos are used for specifying file position information.
// [Example 1: The types streampos and wstreampos are used for positioning streams specialized on char and wchar_t respectively. 
// [Note 2: This synopsis suggests a circularity between streampos and char_traits<char>. An implementation can avoid this circularity by substituting equivalent types. 
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

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

bash
$ clang++ p1488.cpp -std=03 -o p1488l -I. -Wall
In file included from p1488.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 \
 ^
p1488.cpp:18:35: error: use of undeclared identifier 'char8_t'; did you mean 'wchar_t'?
    template<> struct char_traits<char8_t>;
                                  ^~~~~~~
                                  wchar_t
p1488.cpp:19:35: error: use of undeclared identifier 'char16_t'
    template<> struct char_traits<char16_t>;
                                  ^
p1488.cpp:20:35: error: use of undeclared identifier 'char32_t'
    template<> struct char_traits<char32_t>;
                                  ^
p1488.cpp:23:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1488.cpp:23:42: error: template parameter redefines default argument
    template<class charT, class traits = char_traits<charT>>
                                         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:76:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:25:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1488.cpp:25: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:79:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:27:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1488.cpp:27: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:82:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:29:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1488.cpp:29: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:85:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:31:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
p1488.cpp:31: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:88:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:34:47: error: a space is required between consecutive right angle brackets (use '> >')
             class Allocator = allocator<charT>>
                                              ^~
                                              > >
p1488.cpp:37:47: error: a space is required between consecutive right angle brackets (use '> >')
             class Allocator = allocator<charT>>
                                              ^~
                                              > >
p1488.cpp:40:47: error: a space is required between consecutive right angle brackets (use '> >')
             class Allocator = allocator<charT>>
                                              ^~
                                              > >
p1488.cpp:43:47: error: a space is required between consecutive right angle brackets (use '> >')
             class Allocator = allocator<charT>>
                                              ^~
                                              > >
p1488.cpp:45:59: error: a space is required between consecutive right angle brackets (use '> >')
    template<class charT, class traits = char_traits<charT>>
                                                          ^~
                                                          > >
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p1488.cpp -std=2b -o p1488l -I. -Wall
p1488.cpp:23:42: error: template parameter redefines default argument
    template<class charT, class traits = char_traits<charT>>
                                         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:76:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:25: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:79:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:27: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:82:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:29: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:85:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:31: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:88:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:53: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> >
                                               ^
p1488.cpp:55: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> >
                                               ^
p1488.cpp:57: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> >
                                               ^
p1488.cpp:59: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:121:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:67:38: 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:124:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:69:38: 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:127:48: note: previous default template argument defined here
  template<typename _CharT, typename _Traits = char_traits<_CharT> >
                                               ^
p1488.cpp:77:23: error: reference to 'basic_stringbuf' is ambiguous
using stringbuf     = basic_stringbuf<char>;
                      ^
p1488.cpp:35:13: note: candidate found by name lookup is 'std::basic_stringbuf'
      class basic_stringbuf;
            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/sstream:65:11: note: candidate found by name lookup is 'std::__cxx11::basic_stringbuf'
    class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
          ^
p1488.cpp:77:7: error: typedef redefinition with different types ('basic_stringbuf<char>' (aka 'std::basic_stringbuf<char>') vs 'basic_stringbuf<char>' (aka 'std::__cxx11::basic_stringbuf<char>'))
using stringbuf     = basic_stringbuf<char>;
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:147:34: note: previous definition is here
  typedef basic_stringbuf<char>         stringbuf;
                                        ^
p1488.cpp:78:23: error: reference to 'basic_istringstream' is ambiguous
using istringstream = basic_istringstream<char>;
                      ^
p1488.cpp:38:13: note: candidate found by name lookup is 'std::basic_istringstream'
      class basic_istringstream;
            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/sstream:392:11: note: candidate found by name lookup is 'std::__cxx11::basic_istringstream'
    class basic_istringstream : public basic_istream<_CharT, _Traits>
          ^
p1488.cpp:78:7: error: typedef redefinition with different types ('basic_istringstream<char>' (aka 'std::basic_istringstream<char>') vs 'basic_istringstream<char>' (aka 'std::__cxx11::basic_istringstream<char>'))
using istringstream = basic_istringstream<char>;
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:150:38: note: previous definition is here
  typedef basic_istringstream<char>     istringstream;
                                        ^
p1488.cpp:79:23: error: reference to 'basic_ostringstream' is ambiguous
using ostringstream = basic_ostringstream<char>;
                      ^
p1488.cpp:41:13: note: candidate found by name lookup is 'std::basic_ostringstream'
      class basic_ostringstream;
            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/sstream:550:11: note: candidate found by name lookup is 'std::__cxx11::basic_ostringstream'
    class basic_ostringstream : public basic_ostream<_CharT, _Traits>
          ^
p1488.cpp:79:7: error: typedef redefinition with different types ('basic_ostringstream<char>' (aka 'std::basic_ostringstream<char>') vs 'basic_ostringstream<char>' (aka 'std::__cxx11::basic_ostringstream<char>'))
using ostringstream = basic_ostringstream<char>;
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:153:38: note: previous definition is here
  typedef basic_ostringstream<char>     ostringstream;
                                        ^
p1488.cpp:80:23: error: reference to 'basic_stringstream' is ambiguous
using stringstream  = basic_stringstream<char>;
                      ^
p1488.cpp:44:13: note: candidate found by name lookup is 'std::basic_stringstream'
      class basic_stringstream;
            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/sstream:708:11: note: candidate found by name lookup is 'std::__cxx11::basic_stringstream'
    class basic_stringstream : public basic_iostream<_CharT, _Traits>
          ^
p1488.cpp:80:7: error: typedef redefinition with different types ('basic_stringstream<char>' (aka 'std::basic_stringstream<char>') vs 'basic_stringstream<char>' (aka 'std::__cxx11::basic_stringstream<char>'))
using stringstream  = basic_stringstream<char>;
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/iosfwd:156:37: note: previous definition is here
  typedef basic_stringstream<char>      stringstream;
                                        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1488.cpp -std=03 -o p1488g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1488.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 \
      |  ^~~~~
p1488.cpp:18:35: error: 'char8_t' was not declared in this scope; did you mean 'wchar_t'?
   18 |     template<> struct char_traits<char8_t>;
      |                                   ^~~~~~~
      |                                   wchar_t
p1488.cpp:18:42: error: template argument 1 is invalid
   18 |     template<> struct char_traits<char8_t>;
      |                                          ^
p1488.cpp:19:35: error: 'char16_t' was not declared in this scope
   19 |     template<> struct char_traits<char16_t>;
      |                                   ^~~~~~~~
p1488.cpp:19:43: error: template argument 1 is invalid
   19 |     template<> struct char_traits<char16_t>;
      |                                           ^
p1488.cpp:20:35: error: 'char32_t' was not declared in this scope
   20 |     template<> struct char_traits<char32_t>;
      |                                   ^~~~~~~~
p1488.cpp:20:43: error: template argument 1 is invalid
   20 |     template<> struct char_traits<char32_t>;
      |                                           ^
p1488.cpp:23:59: error: spurious '>>', use '>' to terminate a template argument list
   23 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:24:13: error: template argument required for 'class basic_ios'
   24 |       class basic_ios;
      |             ^~~~~~~~~
p1488.cpp:23:42: error: two or more data types in declaration of 'type name'
   23 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:24:22: error: expected '>' before ';' token
   24 |       class basic_ios;
      |                      ^
p1488.cpp:24:22: error: expected unqualified-id before ';' token
p1488.cpp:25:59: error: spurious '>>', use '>' to terminate a template argument list
   25 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:26:13: error: template argument required for 'class basic_streambuf'
   26 |       class basic_streambuf;
      |             ^~~~~~~~~~~~~~~
p1488.cpp:25:42: error: two or more data types in declaration of 'type name'
   25 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:26:28: error: expected '>' before ';' token
   26 |       class basic_streambuf;
      |                            ^
p1488.cpp:26:28: error: expected unqualified-id before ';' token
p1488.cpp:27:59: error: spurious '>>', use '>' to terminate a template argument list
   27 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:28:13: error: template argument required for 'class basic_istream'
   28 |       class basic_istream;
      |             ^~~~~~~~~~~~~
p1488.cpp:27:42: error: two or more data types in declaration of 'type name'
   27 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:28:26: error: expected '>' before ';' token
   28 |       class basic_istream;
      |                          ^
p1488.cpp:28:26: error: expected unqualified-id before ';' token
p1488.cpp:29:59: error: spurious '>>', use '>' to terminate a template argument list
   29 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:30:13: error: template argument required for 'class basic_ostream'
   30 |       class basic_ostream;
      |             ^~~~~~~~~~~~~
p1488.cpp:29:42: error: two or more data types in declaration of 'type name'
   29 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:30:26: error: expected '>' before ';' token
   30 |       class basic_ostream;
      |                          ^
p1488.cpp:30:26: error: expected unqualified-id before ';' token
p1488.cpp:31:59: error: spurious '>>', use '>' to terminate a template argument list
   31 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:32:13: error: template argument required for 'class basic_iostream'
   32 |       class basic_iostream;
      |             ^~~~~~~~~~~~~~
p1488.cpp:31:42: error: two or more data types in declaration of 'type name'
   31 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:32:27: error: expected '>' before ';' token
   32 |       class basic_iostream;
      |                           ^
p1488.cpp:32:27: error: expected unqualified-id before ';' token
p1488.cpp:34:47: error: spurious '>>', use '>' to terminate a template argument list
   34 |              class Allocator = allocator<charT>>
      |                                               ^~
p1488.cpp:35:13: error: template argument required for 'class basic_stringbuf'
   35 |       class basic_stringbuf;
      |             ^~~~~~~~~~~~~~~
p1488.cpp:34:32: error: two or more data types in declaration of 'type name'
   34 |              class Allocator = allocator<charT>>
      |                                ^~~~~~~~~~~~~~~~~
p1488.cpp:35:28: error: expected '>' before ';' token
   35 |       class basic_stringbuf;
      |                            ^
p1488.cpp:35:28: error: expected unqualified-id before ';' token
p1488.cpp:37:47: error: spurious '>>', use '>' to terminate a template argument list
   37 |              class Allocator = allocator<charT>>
      |                                               ^~
p1488.cpp:38:13: error: template argument required for 'class basic_istringstream'
   38 |       class basic_istringstream;
      |             ^~~~~~~~~~~~~~~~~~~
p1488.cpp:37:32: error: two or more data types in declaration of 'type name'
   37 |              class Allocator = allocator<charT>>
      |                                ^~~~~~~~~~~~~~~~~
p1488.cpp:38:32: error: expected '>' before ';' token
   38 |       class basic_istringstream;
      |                                ^
p1488.cpp:38:32: error: expected unqualified-id before ';' token
p1488.cpp:40:47: error: spurious '>>', use '>' to terminate a template argument list
   40 |              class Allocator = allocator<charT>>
      |                                               ^~
p1488.cpp:41:13: error: template argument required for 'class basic_ostringstream'
   41 |       class basic_ostringstream;
      |             ^~~~~~~~~~~~~~~~~~~
p1488.cpp:40:32: error: two or more data types in declaration of 'type name'
   40 |              class Allocator = allocator<charT>>
      |                                ^~~~~~~~~~~~~~~~~
p1488.cpp:41:32: error: expected '>' before ';' token
   41 |       class basic_ostringstream;
      |                                ^
p1488.cpp:41:32: error: expected unqualified-id before ';' token
p1488.cpp:43:47: error: spurious '>>', use '>' to terminate a template argument list
   43 |              class Allocator = allocator<charT>>
      |                                               ^~
p1488.cpp:44:13: error: template argument required for 'class basic_stringstream'
   44 |       class basic_stringstream;
      |             ^~~~~~~~~~~~~~~~~~
p1488.cpp:43:32: error: two or more data types in declaration of 'type name'
   43 |              class Allocator = allocator<charT>>
      |                                ^~~~~~~~~~~~~~~~~
p1488.cpp:44:31: error: expected '>' before ';' token
   44 |       class basic_stringstream;
      |                               ^
p1488.cpp:44:31: error: expected unqualified-id before ';' token
p1488.cpp:45:59: error: spurious '>>', use '>' to terminate a template argument list
   45 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:45:42: error: two or more data types in declaration of 'type name'
   45 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:46:26: error: expected '>' before ';' token
   46 |       class basic_spanbuf;
      |                          ^
p1488.cpp:46:26: error: expected unqualified-id before ';' token
p1488.cpp:47:59: error: spurious '>>', use '>' to terminate a template argument list
   47 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:47:42: error: two or more data types in declaration of 'type name'
   47 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:48:30: error: expected '>' before ';' token
   48 |       class basic_ispanstream;
      |                              ^
p1488.cpp:48:30: error: expected unqualified-id before ';' token
p1488.cpp:49:59: error: spurious '>>', use '>' to terminate a template argument list
   49 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:49:42: error: two or more data types in declaration of 'type name'
   49 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:50:30: error: expected '>' before ';' token
   50 |       class basic_ospanstream;
      |                              ^
p1488.cpp:50:30: error: expected unqualified-id before ';' token
p1488.cpp:51:59: error: spurious '>>', use '>' to terminate a template argument list
   51 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:51:42: error: two or more data types in declaration of 'type name'
   51 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:52:29: error: expected '>' before ';' token
   52 |       class basic_spanstream;
      |                             ^
p1488.cpp:52:29: error: expected unqualified-id before ';' token
p1488.cpp:53:59: error: spurious '>>', use '>' to terminate a template argument list
   53 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:54:13: error: template argument required for 'class basic_filebuf'
   54 |       class basic_filebuf;
      |             ^~~~~~~~~~~~~
p1488.cpp:53:42: error: two or more data types in declaration of 'type name'
   53 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:54:26: error: expected '>' before ';' token
   54 |       class basic_filebuf;
      |                          ^
p1488.cpp:54:26: error: expected unqualified-id before ';' token
p1488.cpp:55:59: error: spurious '>>', use '>' to terminate a template argument list
   55 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:56:13: error: template argument required for 'class basic_ifstream'
   56 |       class basic_ifstream;
      |             ^~~~~~~~~~~~~~
p1488.cpp:55:42: error: two or more data types in declaration of 'type name'
   55 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:56:27: error: expected '>' before ';' token
   56 |       class basic_ifstream;
      |                           ^
p1488.cpp:56:27: error: expected unqualified-id before ';' token
p1488.cpp:57:59: error: spurious '>>', use '>' to terminate a template argument list
   57 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:58:13: error: template argument required for 'class basic_ofstream'
   58 |       class basic_ofstream;
      |             ^~~~~~~~~~~~~~
p1488.cpp:57:42: error: two or more data types in declaration of 'type name'
   57 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:58:27: error: expected '>' before ';' token
   58 |       class basic_ofstream;
      |                           ^
p1488.cpp:58:27: error: expected unqualified-id before ';' token
p1488.cpp:59:59: error: spurious '>>', use '>' to terminate a template argument list
   59 |     template<class charT, class traits = char_traits<charT>>
      |                                                           ^~
p1488.cpp:60:13: error: template argument required for 'class basic_fstream'
   60 |       class basic_fstream;
      |             ^~~~~~~~~~~~~
p1488.cpp:59:42: error: two or more data types in declaration of 'type name'
   59 |     template<class charT, class traits = char_traits<charT>>
      |                                          ^~~~~~~~~~~~~~~~~~~
p1488.cpp:60:26: error: expected '>' before ';' token
   60 |       class basic_fstream;
      |                          ^
p1488.cpp:60:26: error: expected unqualified-id before ';' token
p1488.cpp:62:43: error: spurious '>>', use '>' to terminate a template argument list
   62 |          class Allocator = allocator<charT>>
      |                                           ^~
p1488.cpp:62:28: error: two or more data types in declaration of 'type name'
   62 |          class Allocator = allocator<charT>>
      |                            ^~~~~~~~~~~~~~~~~
p1488.cpp:63:22: error: expected '>' before ';' token
   63 |   class basic_syncbuf;
      |                      ^
p1488.cpp:63:22: error: expected unqualified-id before ';' token
p1488.cpp:65:43: error: spurious '>>', use '>' to terminate a template argument list
   65 |          class Allocator = allocator<charT>>
      |                                           ^~
p1488.cpp:65:28: error: two or more data types in declaration of 'type name'
   65 |          class Allocator = allocator<charT>>
      |                            ^~~~~~~~~~~~~~~~~
p1488.cpp:66:26: error: expected '>' before ';' token
   66 |   class basic_osyncstream;
      |                          ^
p1488.cpp:66:26: error: expected unqualified-id before ';' token
p1488.cpp:67:55: error: spurious '>>', use '>' to terminate a template argument list
   67 | template<class charT, class traits = char_traits<charT>>
      |                                                       ^~
p1488.cpp:68:9: error: template argument required for 'class istreambuf_iterator'
   68 |   class istreambuf_iterator;
      |         ^~~~~~~~~~~~~~~~~~~
p1488.cpp:67:38: error: two or more data types in declaration of 'type name'
   67 | template<class charT, class traits = char_traits<charT>>
      |                                      ^~~~~~~~~~~~~~~~~~~
p1488.cpp:68:28: error: expected '>' before ';' token
   68 |   class istreambuf_iterator;
      |                            ^
p1488.cpp:68:28: error: expected unqualified-id before ';' token
p1488.cpp:69:55: error: spurious '>>', use '>' to terminate a template argument list
   69 | template<class charT, class traits = char_traits<charT>>
      |                                                       ^~
p1488.cpp:70:9: error: template argument required for 'class ostreambuf_iterator'
   70 |   class ostreambuf_iterator;
      |         ^~~~~~~~~~~~~~~~~~~
p1488.cpp:69:38: error: two or more data types in declaration of 'type name'
   69 | template<class charT, class traits = char_traits<charT>>
      |                                      ^~~~~~~~~~~~~~~~~~~
p1488.cpp:70:28: error: expected '>' before ';' token
   70 |   class ostreambuf_iterator;
      |                            ^
p1488.cpp:70:28: error: expected unqualified-id before ';' token
p1488.cpp:71:7: error: expected nested-name-specifier before 'ios'
   71 | using ios  = basic_ios<char>;
      |       ^~~
p1488.cpp:72:7: error: expected nested-name-specifier before 'wios'
   72 | using wios = basic_ios<wchar_t>;
      |       ^~~~
p1488.cpp:73:7: error: expected nested-name-specifier before 'streambuf'
   73 | using streambuf = basic_streambuf<char>;
      |       ^~~~~~~~~
p1488.cpp:74:7: error: expected nested-name-specifier before 'istream'
   74 | using istream   = basic_istream<char>;
      |       ^~~~~~~
p1488.cpp:75:7: error: expected nested-name-specifier before 'ostream'
   75 | using ostream   = basic_ostream<char>;
      |       ^~~~~~~
p1488.cpp:76:7: error: expected nested-name-specifier before 'iostream'
   76 | using iostream  = basic_iostream<char>;
      |       ^~~~~~~~
p1488.cpp:77:7: error: expected nested-name-specifier before 'stringbuf'
   77 | using stringbuf     = basic_stringbuf<char>;
      |       ^~~~~~~~~
p1488.cpp:78:7: error: expected nested-name-specifier before 'istringstream'
   78 | using istringstream = basic_istringstream<char>;
      |       ^~~~~~~~~~~~~
p1488.cpp:79:7: error: expected nested-name-specifier before 'ostringstream'
   79 | using ostringstream = basic_ostringstream<char>;
      |       ^~~~~~~~~~~~~
p1488.cpp:80:7: error: expected nested-name-specifier before 'stringstream'
   80 | using stringstream  = basic_stringstream<char>;
      |       ^~~~~~~~~~~~
p1488.cpp:81:7: error: expected nested-name-specifier before 'spanbuf'
   81 | using spanbuf     = basic_spanbuf<char>;
      |       ^~~~~~~
p1488.cpp:82:7: error: expected nested-name-specifier before 'ispanstream'
   82 | using ispanstream = basic_ispanstream<char>;
      |       ^~~~~~~~~~~
p1488.cpp:83:7: error: expected nested-name-specifier before 'ospanstream'
   83 | using ospanstream = basic_ospanstream<char>;
      |       ^~~~~~~~~~~
p1488.cpp:84:7: error: expected nested-name-specifier before 'spanstream'
   84 | using spanstream  = basic_spanstream<char>;
      |       ^~~~~~~~~~
p1488.cpp:85:7: error: expected nested-name-specifier before 'filebuf'
   85 | using filebuf  = basic_filebuf<char>;
      |       ^~~~~~~
p1488.cpp:86:7: error: expected nested-name-specifier before 'ifstream'
   86 | using ifstream = basic_ifstream<char>;
      |       ^~~~~~~~
p1488.cpp:87:7: error: expected nested-name-specifier before 'ofstream'
   87 | using ofstream = basic_ofstream<char>;
      |       ^~~~~~~~
p1488.cpp:88:7: error: expected nested-name-specifier before 'fstream'
   88 | using fstream  = basic_fstream<char>;
      |       ^~~~~~~
p1488.cpp:89:7: error: expected nested-name-specifier before 'syncbuf'
   89 | using syncbuf = basic_syncbuf<char>;
      |       ^~~~~~~
p1488.cpp:90:7: error: expected nested-name-specifier before 'osyncstream'
   90 | using osyncstream = basic_osyncstream<char>;
      |       ^~~~~~~~~~~
p1488.cpp:91:7: error: expected nested-name-specifier before 'wstreambuf'
   91 | using wstreambuf = basic_streambuf<wchar_t>;
      |       ^~~~~~~~~~
p1488.cpp:92:7: error: expected nested-name-specifier before 'wistream'
   92 | using wistream   = basic_istream<wchar_t>;
      |       ^~~~~~~~
p1488.cpp:93:7: error: expected nested-name-specifier before 'wostream'
   93 | using wostream   = basic_ostream<wchar_t>;
      |       ^~~~~~~~
p1488.cpp:94:7: error: expected nested-name-specifier before 'wiostream'
   94 | using wiostream  = basic_iostream<wchar_t>;
      |       ^~~~~~~~~
p1488.cpp:95:7: error: expected nested-name-specifier before 'wstringbuf'
   95 | using wstringbuf     = basic_stringbuf<wchar_t>;
      |       ^~~~~~~~~~
p1488.cpp:96:7: error: expected nested-name-specifier before 'wistringstream'
   96 | using wistringstream = basic_istringstream<wchar_t>;
      |       ^~~~~~~~~~~~~~
p1488.cpp:97:7: error: expected nested-name-specifier before 'wostringstream'
   97 | using wostringstream = basic_ostringstream<wchar_t>;
      |       ^~~~~~~~~~~~~~
p1488.cpp:98:7: error: expected nested-name-specifier before 'wstringstream'
   98 | using wstringstream  = basic_stringstream<wchar_t>;
      |       ^~~~~~~~~~~~~
p1488.cpp:99:7: error: expected nested-name-specifier before 'wspanbuf'
   99 | using wspanbuf     = basic_spanbuf<wchar_t>;
      |       ^~~~~~~~
p1488.cpp:100:7: error: expected nested-name-specifier before 'wispanstream'
  100 | using wispanstream = basic_ispanstream<wchar_t>;
      |       ^~~~~~~~~~~~
p1488.cpp:101:7: error: expected nested-name-specifier before 'wospanstream'
  101 | using wospanstream = basic_ospanstream<wchar_t>;
      |       ^~~~~~~~~~~~
p1488.cpp:102:7: error: expected nested-name-specifier before 'wspanstream'
  102 | using wspanstream  = basic_spanstream<wchar_t>;
      |       ^~~~~~~~~~~
p1488.cpp:103:7: error: expected nested-name-specifier before 'wfilebuf'
  103 | using wfilebuf  = basic_filebuf<wchar_t>;
      |       ^~~~~~~~
p1488.cpp:104:7: error: expected nested-name-specifier before 'wifstream'
  104 | using wifstream = basic_ifstream<wchar_t>;
      |       ^~~~~~~~~
p1488.cpp:105:7: error: expected nested-name-specifier before 'wofstream'
  105 | using wofstream = basic_ofstream<wchar_t>;
      |       ^~~~~~~~~
p1488.cpp:106:7: error: expected nested-name-specifier before 'wfstream'
  106 | using wfstream  = basic_fstream<wchar_t>;
      |       ^~~~~~~~
p1488.cpp:107:7: error: expected nested-name-specifier before 'wsyncbuf'
  107 | using wsyncbuf = basic_syncbuf<wchar_t>;
      |       ^~~~~~~~
p1488.cpp:108:7: error: expected nested-name-specifier before 'wosyncstream'
  108 | using wosyncstream = basic_osyncstream<wchar_t>;
      |       ^~~~~~~~~~~~
p1488.cpp:110:7: error: expected nested-name-specifier before 'streampos'
  110 | using streampos  = fpos<char_traits<char>::state_type>;
      |       ^~~~~~~~~
p1488.cpp:111:7: error: expected nested-name-specifier before 'wstreampos'
  111 | using wstreampos = fpos<char_traits<wchar_t>::state_type>;
      |       ^~~~~~~~~~
p1488.cpp:112:7: error: expected nested-name-specifier before 'u8streampos'
  112 | using u8streampos = fpos<char_traits<char8_t>::state_type>;
      |       ^~~~~~~~~~~
p1488.cpp:113:7: error: expected nested-name-specifier before 'u16streampos'
  113 | using u16streampos = fpos<char_traits<char16_t>::state_type>;
      |       ^~~~~~~~~~~~
p1488.cpp:114:7: error: expected nested-name-specifier before 'u32streampos'
  114 | using u32streampos = fpos<char_traits<char32_t>::state_type>;
      |       ^~~~~~~~~~~~

$ g++ p1488.cpp -std=2b -o p1488g -I. -Wall
p1488.cpp:23:27: error: redefinition of default argument for 'class traits'
   23 |     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 p1488.cpp:10:
/usr/local/include/c++/12.1.0/iosfwd:76:29: note: original definition appeared here
   76 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1488.cpp:25:27: error: redefinition of default argument for 'class traits'
   25 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:79:29: note: original definition appeared here
   79 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1488.cpp:27:27: error: redefinition of default argument for 'class traits'
   27 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:82:29: note: original definition appeared here
   82 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1488.cpp:29:27: error: redefinition of default argument for 'class traits'
   29 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:85:29: note: original definition appeared here
   85 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1488.cpp:31:27: error: redefinition of default argument for 'class traits'
   31 |     template<class charT, class traits = char_traits<charT>>
      |                           ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:88:29: note: original definition appeared here
   88 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1488.cpp:53:27: error: redefinition of default argument for 'class traits'
   53 |     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> >
      |                             ^~~~~~~~
p1488.cpp:55:27: error: redefinition of default argument for 'class traits'
   55 |     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> >
      |                             ^~~~~~~~
p1488.cpp:57:27: error: redefinition of default argument for 'class traits'
   57 |     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> >
      |                             ^~~~~~~~
p1488.cpp:59:27: error: redefinition of default argument for 'class traits'
   59 |     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> >
      |                             ^~~~~~~~
p1488.cpp:67:23: error: redefinition of default argument for 'class traits'
   67 | template<class charT, class traits = char_traits<charT>>
      |                       ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:124:29: note: original definition appeared here
  124 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1488.cpp:69:23: error: redefinition of default argument for 'class traits'
   69 | template<class charT, class traits = char_traits<charT>>
      |                       ^~~~~
/usr/local/include/c++/12.1.0/iosfwd:127:29: note: original definition appeared here
  127 |   template<typename _CharT, typename _Traits = char_traits<_CharT> >
      |                             ^~~~~~~~
p1488.cpp:77:23: error: reference to 'basic_stringbuf' is ambiguous
   77 | using stringbuf     = basic_stringbuf<char>;
      |                       ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:96:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_stringbuf'
   96 |     class basic_stringbuf;
      |           ^~~~~~~~~~~~~~~
p1488.cpp:35:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_stringbuf'
   35 |       class basic_stringbuf;
      |             ^~~~~~~~~~~~~~~
p1488.cpp:78:23: error: reference to 'basic_istringstream' is ambiguous
   78 | using istringstream = basic_istringstream<char>;
      |                       ^~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:100:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_istringstream'
  100 |     class basic_istringstream;
      |           ^~~~~~~~~~~~~~~~~~~
p1488.cpp:38:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_istringstream'
   38 |       class basic_istringstream;
      |             ^~~~~~~~~~~~~~~~~~~
p1488.cpp:79:23: error: reference to 'basic_ostringstream' is ambiguous
   79 | using ostringstream = basic_ostringstream<char>;
      |                       ^~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:104:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_ostringstream'
  104 |     class basic_ostringstream;
      |           ^~~~~~~~~~~~~~~~~~~
p1488.cpp:41:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_ostringstream'
   41 |       class basic_ostringstream;
      |             ^~~~~~~~~~~~~~~~~~~
p1488.cpp:80:23: error: reference to 'basic_stringstream' is ambiguous
   80 | using stringstream  = basic_stringstream<char>;
      |                       ^~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:108:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_stringstream'
  108 |     class basic_stringstream;
      |           ^~~~~~~~~~~~~~~~~~
p1488.cpp:44:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_stringstream'
   44 |       class basic_stringstream;
      |             ^~~~~~~~~~~~~~~~~~
p1488.cpp:95:24: error: reference to 'basic_stringbuf' is ambiguous
   95 | using wstringbuf     = basic_stringbuf<wchar_t>;
      |                        ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:96:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_stringbuf'
   96 |     class basic_stringbuf;
      |           ^~~~~~~~~~~~~~~
p1488.cpp:35:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_stringbuf'
   35 |       class basic_stringbuf;
      |             ^~~~~~~~~~~~~~~
p1488.cpp:96:24: error: reference to 'basic_istringstream' is ambiguous
   96 | using wistringstream = basic_istringstream<wchar_t>;
      |                        ^~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:100:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_istringstream'
  100 |     class basic_istringstream;
      |           ^~~~~~~~~~~~~~~~~~~
p1488.cpp:38:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_istringstream'
   38 |       class basic_istringstream;
      |             ^~~~~~~~~~~~~~~~~~~
p1488.cpp:97:24: error: reference to 'basic_ostringstream' is ambiguous
   97 | using wostringstream = basic_ostringstream<wchar_t>;
      |                        ^~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:104:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_ostringstream'
  104 |     class basic_ostringstream;
      |           ^~~~~~~~~~~~~~~~~~~
p1488.cpp:41:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_ostringstream'
   41 |       class basic_ostringstream;
      |             ^~~~~~~~~~~~~~~~~~~
p1488.cpp:98:24: error: reference to 'basic_stringstream' is ambiguous
   98 | using wstringstream  = basic_stringstream<wchar_t>;
      |                        ^~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/iosfwd:108:11: note: candidates are: 'template<class _CharT, class _Traits, class _Alloc> class std::__cxx11::basic_stringstream'
  108 |     class basic_stringstream;
      |           ^~~~~~~~~~~~~~~~~~
p1488.cpp:44:13: note:                 'template<class charT, class traits, class Allocator> class std::basic_stringstream'
   44 |       class basic_stringstream;
      |             ^~~~~~~~~~~~~~~~~~

検討事項(agenda)

コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

応用例1 AUTOSAR C++

AUTOSARでC++のコーディング標準を作っている。 
MISRA-C++コーディング標準の改訂をまたずに、C++14に対応したかったためかもしれない。 

Autosar Guidelines C++14 example code compile list

MISRA C++, AUTOSAR C++について

応用例2 MISRA C/C++

MISRA C まとめ #include

MISRA C++ 5-0-16

応用例3 CERT C/C++

SEI CERT C++ Coding Standard AA. Bibliography 確認中。

MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする

応用例4 箱庭 

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

箱庭ではUnityをはじめC++を使っているらしい。 

ここでコンパイルしたコードと同じようなコードを使っているか、
ここで出たコンパイルエラーと同じようなエラーがでたかを
いろいろな版のコンパイラでコンパイルして確認していく。

この項目は、箱庭プロジェクトを市場分析の対象として、原則的には、箱庭プロジェクトの外部から分析し、外部から箱庭の広告宣伝のための戦略会議を仮想した結果、仮想「箱庭もくもく会」を開催してみることを企画するものである。 
一切の内容は、箱庭プロジェクト、Athrill, TOPPERSとは無関係である。 
一(いち)参加データアナリストの、個人的なつぶやきです。

仮想戦略会議「箱庭」

お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(1)

お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(2)

エンジニア夏休み企画

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

個人開発

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

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

読書感想文

CコンパイラによるC言語規格の読書感想文として掲載しています。
コンパイル実験が、C++N4910に対する、G++とClang++による感想文だということご理解いただけると幸いです。

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

自己参考資料(self reference)

関連する自己参照以外は、こちらの先頭に移転。

C言語(C++)に対する誤解、曲解、無理解、爽快。

#include "N4910.h"

C++N4910資料の改善点

dockerにclang

docker gnu(gcc/g++) and llvm(clang/clang++)

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)

C++N4910:2022 tag follower 300人超えました。ありがとうございます。

astyle 使ってみた

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>

文書履歴(document history)

ver. 0.01 初稿  20220824

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0