0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

13.7.7.3 Partial ordering of function templates [temp.func.order] C++N4910:2022 (225) p389.cpp

Posted at

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

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

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

背景(back ground)

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

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

https://stackoverflow.com
https://cpprefjp.github.io
http://ja.cppreference.com/

また
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.

13.7.7.3 Partial ordering of function templates [temp.func.order] C++N4910:2022 (225) p389.cpp

算譜(source code)

p389.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 = "13.7.7.3 Partial ordering of function templates [temp.func.order] C++N4910:2022 (225) p389.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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <coroutine>
#include <vector>
#include <complex>
#include <map>
#include <atomic>
#include <unordered_map>
#include <typeinfo>

using namespace std;

// Example 1
struct A { };
template<class T> struct B {
    template<class R> int operator*(R&);
};
// #1
//calls#1
template<class T, class R> int operator*(T&, R&);
// The declaration of B::operator* is transformed into the equivalent of
// template<class R> int operator*(B<A>&, R&);
// int main() {
//  A a;
// B<A> b; b * a;
// }
// [Example 2:
template<class T> struct A2 {
    A2();
};
// #2 // #1a
template<class T> void f(T);
template<class T> void f(T*);
template<class T> void f(const T*);
template<class T> void g(T);
template<class T> void g(T&);
template<class T> void h(const T&);
template<class T> void h(A2<T>&);
void m() {
    const int* p;
    f(p); // f(const T*) is more specialized than f(T) or f(T*) float x;
    g(x); // ambiguous: g(T) or g(T&)
    A2<int> z;
    h(z); // overload resolution selects h(A<T>&)
    const A2<int> z2;
    h(z2); // h(const T&) is called because h(A<T>&) is not callable
}
// [Example 3:
template<class T> void f3(T);
template<class T> void f3(T*, int=1);
template<class T> void g3(T);
template<class T> void g3(T*, ...);
//  int main() {
//    int* ip;
//    f(ip);
//    g(ip);
// }
// [Example 4:
// #1 // #2 // #3 // #4
// calls #2 // calls #4
// #1 // #2 // #3 // #4
// calls #2
// error: ambiguous // error: ambiguous
// #1 // #2 // #3 // #4
// OK, calls #2 // OK, calls #3
template<class T, class U> struct A4 { };
template<class T, class U> void f4(U, A4<U, T>* p = 0);
template<class U> void f4(U, A<U, U>* p = 0);
template<class T > void g4(T, T = T());
template<class T, class... U> void g4(T, U ...);
void h4() {
    f4<int>(42, (A4<int, int>*)0);
    f4<int>(42);
    g4(42);
}
// [Example 5:
template<class T, class... U> void f5(T, U...);
template<class T            > void f5(T);
template<class T, class... U> void g5(T*, U...);
template<class T > void g5(T);
void h5(int i) {
    f5(&i);
    g5(&i);
}
// [Example 6:
template <typename> constexpr bool True = true;
template <typename T> concept C = True<T>;
void f6(C auto &, auto &) = delete;
template <C Q> void f6(Q &, C auto &);
void g6(struct A6 *ap, struct B6 *bp) {
    f6(*ap, *bp); // OK, can use different methods to produce template parameters
}
template <typename T, typename U6> struct X6 {};
template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
template <C T, C U6, C V>
void h6() {
    X6<void *, int> {} == 0;
    bool operator==(T, X6<U6, V>);
// OK, correspondence of [ T, U, V] and [ U, V, T]
}
int main() {
// Example 1
    A a;
    B<A> b;
    b * a;
// Example 3
    int* ip;
    f(ip);
    g(ip);
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

Script

clgc.sh
#!/bin/sh
rm $1l
rm $1g
echo "$ clang++ $1.cpp -std=03 -o $1l -I. -Wall" 
clang++ $1.cpp -std=c++03 -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l 
fi
rm $1l
echo "$ clang++ $1.cpp -std=2b -o $1l -I. -Wall"
clang++ $1.cpp -std=c++2b -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l
fi
echo "\r"
echo "$ g++ $1.cpp -std=03 -o $1g -I. -Wall"
g++ $1.cpp -std=c++03 -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g
fi
rm $1g
echo "\r"
echo "$ g++ $1.cpp -std=2b -o $1g -I. -Wall"
g++ $1.cpp -std=c++2b -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g 
fi

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

bash
# ./clgc.sh p389
rm: cannot remove 'p389l': No such file or directory
rm: cannot remove 'p389g': No such file or directory
$ clang++ p389.cpp -std=c++03 -o p389l -I. -Wall
In file included from p389.cpp:19:
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 \
 ^
p389.cpp:52:3: error: use of undeclared identifier 'x'
g(x); // ambiguous: g(T) or g(T&)
  ^
p389.cpp:78:31: error: expected ')'
template<class U> void f4(U, A<U, U>* p = 0);
                              ^
p389.cpp:78:26: note: to match this '('
template<class U> void f4(U, A<U, U>* p = 0);
                         ^
p389.cpp:80:24: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<class T, class... U> void g4(T, U ...);
                       ^
p389.cpp:87:26: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
  template<class T, class... U> void f5(T, U...);
                         ^
p389.cpp:89:26: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
  template<class T, class... U> void g5(T*, U...);
                         ^
p389.cpp:96:21: error: unknown type name 'constexpr'
template <typename> constexpr bool True = true;
                    ^
p389.cpp:96:36: warning: variable templates are a C++14 extension [-Wc++14-extensions]
template <typename> constexpr bool True = true;
                                   ^
p389.cpp:97:25: error: unknown type name 'concept'
  template <typename T> concept C = True<T>;
                        ^
p389.cpp:97:33: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  template <typename T> concept C = True<T>;
                                ^
p389.cpp:98:8: error: variable has incomplete type 'void'
  void f6(C auto &, auto &) = delete;
       ^
p389.cpp:98:21: error: expected expression
  void f6(C auto &, auto &) = delete;
                    ^
p389.cpp:98:28: error: expected ';' after top level declarator
  void f6(C auto &, auto &) = delete;
                           ^
                           ;
p389.cpp:99:13: error: unknown type name 'C'
  template <C Q> void f6(Q &, C auto &);
            ^
p389.cpp:99:23: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  template <C Q> void f6(Q &, C auto &);
                      ^
p389.cpp:99:23: error: variable has incomplete type 'void'
p389.cpp:99:29: error: expected expression
  template <C Q> void f6(Q &, C auto &);
                            ^
p389.cpp:104:23: error: unknown type name 'C'
template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
                      ^
p389.cpp:104:63: error: template argument for template type parameter must be a type
template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
                                                              ^~
p389.cpp:103:32: note: template parameter is declared here
template <typename T, typename U6> struct X6 {};
                               ^
p389.cpp:104:73: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
                                                                        ^
p389.cpp:105:11: error: unknown type name 'C'
template <C T, C U6, C V>
          ^
p389.cpp:105:16: error: unknown type name 'C'
template <C T, C U6, C V>
               ^
p389.cpp:105:22: error: unknown type name 'C'
template <C T, C U6, C V>
                     ^
p389.cpp:107:18: error: expected unqualified-id
  X6<void *, int>{} == 0;
                 ^
p389.cpp:107:21: error: expected expression
  X6<void *, int>{} == 0;
                    ^
p389.cpp:108:24: error: unknown type name 'T'
       bool operator==(T, X6<U6, V>);
                       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
rm: cannot remove 'p389l': No such file or directory
$ clang++ p389.cpp -std=c++2b -o p389l -I. -Wall
p389.cpp:52:3: error: use of undeclared identifier 'x'
g(x); // ambiguous: g(T) or g(T&)
  ^
p389.cpp:78:31: error: expected ')'
template<class U> void f4(U, A<U, U>* p = 0);
                              ^
p389.cpp:78:26: note: to match this '('
template<class U> void f4(U, A<U, U>* p = 0);
                         ^
p389.cpp:107:21: error: overload resolution selected deleted operator '=='
  X6<void *, int>{} == 0;
  ~~~~~~~~~~~~~~~~~ ^  ~
p389.cpp:104:46: note: candidate function [with T = void *, U6 = int, V = int] has been explicitly deleted
template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
                                             ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/coroutine:136:18: note: candidate function not viable: no known conversion from 'X6<void *, int>' to 'coroutine_handle<>' for 1st argument
  constexpr bool operator==(coroutine_handle<> __a,
                 ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:342:3: note: candidate function not viable: no known conversion from 'X6<void *, int>' to 'const std::error_code' for 1st argument
  operator==(const error_code& __lhs, const error_code& __rhs) noexcept
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:349:3: note: candidate function not viable: no known conversion from 'X6<void *, int>' to 'const std::error_code' for 1st argument
  operator==(const error_code& __lhs, const error_condition& __rhs) noexcept
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:349:3: note: candidate function (with reversed parameter order) not viable: no known conversion from 'X6<void *, int>' to 'const std::error_condition' for 1st argument
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/system_error:357:3: note: candidate function not viable: no known conversion from 'X6<void *, int>' to 'const std::error_condition' for 1st argument
  operator==(const error_condition& __lhs,
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/postypes.h:222:5: note: candidate template ignored: could not match 'fpos' against 'X6'
    operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_pair.h:466:5: note: candidate template ignored: could not match 'pair' against 'X6'
    operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:459:5: note: candidate template ignored: could not match 'reverse_iterator' against 'X6'
    operator==(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:459:5: note: candidate template ignored: could not match 'reverse_iterator<_IteratorL>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:1460:5: note: candidate template ignored: could not match 'move_iterator' against 'X6'
    operator==(const move_iterator<_IteratorL>& __x,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:1460:5: note: candidate template ignored: could not match 'move_iterator<_IteratorL>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/allocator.h:206:5: note: candidate template ignored: could not match 'allocator' against 'X6'
    operator==(const allocator<_T1>&, const allocator<_T2>&)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/allocator.h:206:5: note: candidate template ignored: could not match 'allocator<_T1>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/string_view:487:5: note: candidate template ignored: could not match 'basic_string_view' against 'X6'
    operator==(basic_string_view<_CharT, _Traits> __x,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/string_view:493:5: note: candidate template ignored: could not match 'basic_string_view' against 'X6'
    operator==(basic_string_view<_CharT, _Traits> __x,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/string_view:493:5: note: candidate template ignored: could not match 'basic_string_view<_CharT, _Traits>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:6163:5: note: candidate template ignored: could not match 'basic_string' against 'X6'
    operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:6171:5: note: candidate template ignored: could not match 'basic_string' against 'X6'
    operator==(const basic_string<_CharT>& __lhs,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:6185:5: note: candidate template ignored: could not match 'basic_string' against 'X6'
    operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:6185:5: note: candidate template ignored: could not match 'basic_string<_CharT, _Traits, _Alloc>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/streambuf_iterator.h:227:5: note: candidate template ignored: could not match 'istreambuf_iterator' against 'X6'
    operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:1892:5: note: candidate template ignored: could not match 'vector' against 'X6'
    operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/complex:463:5: note: candidate template ignored: could not match 'complex' against 'X6'
    operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/complex:468:5: note: candidate template ignored: could not match 'complex' against 'X6'
    operator==(const complex<_Tp>& __x, const _Tp& __y)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/complex:468:5: note: candidate template ignored: could not match 'complex<_Tp>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1015:5: note: candidate template ignored: could not match 'optional' against 'X6'
    operator==(const optional<_Tp>& __lhs, const optional<_Up>& __rhs)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1015:5: note: candidate template ignored: could not match 'optional<_Tp>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1075:5: note: candidate template ignored: could not match 'optional' against 'X6'
    operator==(const optional<_Tp>& __lhs, nullopt_t) noexcept
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1075:5: note: candidate template ignored: could not match 'optional<_Tp>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1143:5: note: candidate template ignored: could not match 'optional' against 'X6'
    operator==(const optional<_Tp>& __lhs, const _Up& __rhs)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1143:5: note: candidate template ignored: could not match 'optional<_Tp>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1149:5: note: candidate template ignored: could not match 'optional<_Tp>' against 'int'
    operator==(const _Up& __lhs, const optional<_Tp>& __rhs)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:1149:5: note: candidate template ignored: could not match 'optional' against 'X6'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/array:253:5: note: candidate template ignored: could not match 'array' against 'X6'
    operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1393:5: note: candidate template ignored: could not match 'tuple' against 'X6'
    operator==(const tuple<_TElements...>& __t,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1393:5: note: candidate template ignored: could not match 'tuple<_TElements...>' against 'int'
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_map.h:1463:5: note: candidate template ignored: could not match 'map' against 'X6'
    operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_multimap.h:1128:5: note: candidate template ignored: could not match 'multimap' against 'X6'
    operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unordered_map.h:2090:5: note: candidate template ignored: could not match 'unordered_map' against 'X6'
    operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unordered_map.h:2104:5: note: candidate template ignored: could not match 'unordered_multimap' against 'X6'
    operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
    ^
p389.cpp:104:46: note: candidate template ignored: could not match 'X6<T, U6>' against 'int'
template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
                                             ^
p389.cpp:118:5: error: call to 'g' is ambiguous
    g(ip);
    ^
p389.cpp:45:29: note: candidate function [with T = int *]
     template<class T> void g(T);
                            ^
p389.cpp:46:29: note: candidate function [with T = int *]
     template<class T> void g(T&);
                            ^
4 errors generated.

$ g++ p389.cpp -std=c++03 -o p389g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from p389.cpp:19:
/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 \
      |  ^~~~~
p389.cpp:96:21: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   96 | template <typename> constexpr bool True = true;
      |                     ^~~~~~~~~
p389.cpp: In function 'void m()':
p389.cpp:52:3: error: 'x' was not declared in this scope
   52 | g(x); // ambiguous: g(T) or g(T&)
      |   ^
p389.cpp: At global scope:
p389.cpp:78:30: error: 'A' is not a template
   78 | template<class U> void f4(U, A<U, U>* p = 0);
      |                              ^
p389.cpp:80:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   80 | template<class T, class... U> void g4(T, U ...);
      |                        ^~~
p389.cpp:80:44: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   80 | template<class T, class... U> void g4(T, U ...);
      |                                            ^~~
p389.cpp: In function 'void h4()':
p389.cpp:83:12: error: call of overloaded 'f4<int>(int)' is ambiguous
   83 |     f4<int>(42);
      |     ~~~~~~~^~~~
p389.cpp:77:33: note: candidate: 'void f4(U, A4<U, T>*) [with T = int; U = int]'
   77 | template<class T, class U> void f4(U, A4<U, T>* p = 0);
      |                                 ^~
p389.cpp:78:24: note: candidate: 'void f4(U, A*) [with U = int]'
   78 | template<class U> void f4(U, A<U, U>* p = 0);
      |                        ^~
p389.cpp: At global scope:
p389.cpp:87:26: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   87 |   template<class T, class... U> void f5(T, U...);
      |                          ^~~
p389.cpp:87:45: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   87 |   template<class T, class... U> void f5(T, U...);
      |                                             ^~~
p389.cpp:89:26: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   89 |   template<class T, class... U> void g5(T*, U...);
      |                          ^~~
p389.cpp:89:46: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   89 |   template<class T, class... U> void g5(T*, U...);
      |                                              ^~~
p389.cpp:96:21: error: 'constexpr' does not name a type
   96 | template <typename> constexpr bool True = true;
      |                     ^~~~~~~~~
p389.cpp:96:21: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p389.cpp:97:25: error: 'concept' does not name a type; did you mean 'const'?
   97 |   template <typename T> concept C = True<T>;
      |                         ^~~~~~~
      |                         const
p389.cpp:97:25: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p389.cpp:98:13: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
   98 |   void f6(C auto &, auto &) = delete;
      |             ^~~~
      |             ----
p389.cpp:98:8: error: variable or field 'f6' declared void
   98 |   void f6(C auto &, auto &) = delete;
      |        ^~
p389.cpp:98:11: error: 'C' was not declared in this scope
   98 |   void f6(C auto &, auto &) = delete;
      |           ^
p389.cpp:98:19: warning: C++11 auto only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   98 |   void f6(C auto &, auto &) = delete;
      |                   ^
p389.cpp:98:21: error: expected primary-expression before 'auto'
   98 |   void f6(C auto &, auto &) = delete;
      |                     ^~~~
p389.cpp:99:13: error: 'C' has not been declared
   99 |   template <C Q> void f6(Q &, C auto &);
      |             ^
p389.cpp:99:23: error: variable or field 'f6' declared void
   99 |   template <C Q> void f6(Q &, C auto &);
      |                       ^~
p389.cpp:99:26: error: 'Q' was not declared in this scope
   99 |   template <C Q> void f6(Q &, C auto &);
      |                          ^
p389.cpp:99:29: error: expected primary-expression before ',' token
   99 |   template <C Q> void f6(Q &, C auto &);
      |                             ^
p389.cpp:99:31: error: 'C' was not declared in this scope
   99 |   template <C Q> void f6(Q &, C auto &);
      |                               ^
p389.cpp: In function 'void g6(A6*, B6*)':
p389.cpp:101:1: error: 'f6' was not declared in this scope; did you mean 'g6'?
  101 | f6(*ap, *bp); // OK, can use different methods to produce template parameters
      | ^~
      | g6
p389.cpp: At global scope:
p389.cpp:104:23: error: 'C' has not been declared
  104 | template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
      |                       ^
p389.cpp:104:63: error: 'U6' was not declared in this scope; did you mean 'g6'?
  104 | template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
      |                                                               ^~
      |                                                               g6
p389.cpp:104:65: error: template argument 2 is invalid
  104 | template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
      |                                                                 ^
p389.cpp:104:69: error: no default argument for 'V'
  104 | template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
      |                                                                     ^
p389.cpp:104:69: error: default template arguments may not be used in function templates without '-std=c++11' or '-std=gnu++11'
p389.cpp:104:73: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  104 | template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
      |                                                                         ^~~~~~
p389.cpp:105:11: error: 'C' has not been declared
  105 | template <C T, C U6, C V>
      |           ^
p389.cpp:105:16: error: 'C' has not been declared
  105 | template <C T, C U6, C V>
      |                ^
p389.cpp:105:22: error: 'C' has not been declared
  105 | template <C T, C U6, C V>
      |                      ^
p389.cpp:106:9: error: default template arguments may not be used in function templates without '-std=c++11' or '-std=gnu++11'
  106 | void h6() {
      |         ^
p389.cpp: In function 'void h6()':
p389.cpp:107:18: warning: extended initializer lists only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  107 |   X6<void *, int>{} == 0;
      |                  ^
p389.cpp:107:21: error: no match for 'operator==' (operand types are 'X6<void*, int>' and 'int')
  107 |   X6<void *, int>{} == 0;
      |   ~~~~~~~~~~~~~~~~~~^~~~
p389.cpp:104:46: note: candidate: 'template<class T, <declaration error>, class V> bool operator==(int, V)' (deleted)
  104 | template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
      |                                              ^~~~~~~~
p389.cpp:104:46: note:   template argument deduction/substitution failed:
In file included from /usr/local/include/c++/12.1.0/iosfwd:40,
                 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 p389.cpp:10:
/usr/local/include/c++/12.1.0/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
  192 |     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/postypes.h:192:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::fpos<_StateT>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/string:41,
                 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:
/usr/local/include/c++/12.1.0/bits/allocator.h:214:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
  214 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/allocator.h:214:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::allocator<_CharT>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/string:47:
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:444:5: note: candidate: 'template<class _Iterator> bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  444 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:444:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:489:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  489 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:489:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/bits/stl_algobase.h:64,
                 from /usr/local/include/c++/12.1.0/string:50:
/usr/local/include/c++/12.1.0/bits/stl_pair.h:640:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
  640 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_pair.h:640:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::pair<_T1, _T2>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/string:53:
/usr/local/include/c++/12.1.0/bits/basic_string.h:3575:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 3575 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/basic_string.h:3575:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
/usr/local/include/c++/12.1.0/bits/basic_string.h:3584:5: note: candidate: 'template<class _CharT> typename __gnu_cxx::__enable_if<std::__is_char<_Tp>::__value, bool>::__type std::operator==(const __cxx11::basic_string<_CharT>&, const __cxx11::basic_string<_CharT>&)'
 3584 |     operator==(const basic_string<_CharT>& __lhs,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/basic_string.h:3584:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::__cxx11::basic_string<_CharT>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
/usr/local/include/c++/12.1.0/bits/basic_string.h:3599:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 3599 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/basic_string.h:3599:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
/usr/local/include/c++/12.1.0/bits/basic_string.h:3640:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 3640 |     operator==(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/basic_string.h:3640:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   mismatched types 'const _CharT*' and 'X6<void*, int>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/bits/locale_facets.h:48,
                 from /usr/local/include/c++/12.1.0/bits/basic_ios.h:37,
                 from /usr/local/include/c++/12.1.0/ios:44:
/usr/local/include/c++/12.1.0/bits/streambuf_iterator.h:233:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
  233 |     operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/streambuf_iterator.h:233:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/vector:64,
                 from p389.cpp:16:
/usr/local/include/c++/12.1.0/bits/stl_vector.h:2035:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
 2035 |     operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_vector.h:2035:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::vector<_Tp, _Alloc>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from p389.cpp:17:
/usr/local/include/c++/12.1.0/complex:464:5: note: candidate: 'template<class _Tp> bool std::operator==(const complex<_Tp>&, const complex<_Tp>&)'
  464 |     operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/complex:464:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::complex<_Tp>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
/usr/local/include/c++/12.1.0/complex:469:5: note: candidate: 'template<class _Tp> bool std::operator==(const complex<_Tp>&, const _Tp&)'
  469 |     operator==(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/complex:469:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::complex<_Tp>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
/usr/local/include/c++/12.1.0/complex:475:5: note: candidate: 'template<class _Tp> bool std::operator==(const _Tp&, const complex<_Tp>&)'
  475 |     operator==(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/complex:475:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   mismatched types 'const std::complex<_Tp>' and 'int'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/map:61,
                 from p389.cpp:18:
/usr/local/include/c++/12.1.0/bits/stl_map.h:1511:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator==(const map<_Key, _Tp, _Compare, _Alloc>&, const map<_Key, _Tp, _Compare, _Alloc>&)'
 1511 |     operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_map.h:1511:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::map<_Key, _Tp, _Compare, _Alloc>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
In file included from /usr/local/include/c++/12.1.0/map:62:
/usr/local/include/c++/12.1.0/bits/stl_multimap.h:1132:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator==(const multimap<_Key, _Tp, _Compare, _Alloc>&, const multimap<_Key, _Tp, _Compare, _Alloc>&)'
 1132 |     operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_multimap.h:1132:5: note:   template argument deduction/substitution failed:
p389.cpp:107:24: note:   'X6<void*, int>' is not derived from 'const std::multimap<_Key, _Tp, _Compare, _Alloc>'
  107 |   X6<void *, int>{} == 0;
      |                        ^
p389.cpp:108:13: error: declaration of 'operator==' as non-function
  108 |        bool operator==(T, X6<U6, V>);
      |             ^~~~~~~~
p389.cpp:108:24: error: 'T' was not declared in this scope
  108 |        bool operator==(T, X6<U6, V>);
      |                        ^
p389.cpp:108:30: error: 'U6' was not declared in this scope; did you mean 'h6'?
  108 |        bool operator==(T, X6<U6, V>);
      |                              ^~
      |                              h6
p389.cpp:108:34: error: 'V' was not declared in this scope
  108 |        bool operator==(T, X6<U6, V>);
      |                                  ^
p389.cpp:108:35: error: template argument 1 is invalid
  108 |        bool operator==(T, X6<U6, V>);
      |                                   ^
p389.cpp:108:35: error: template argument 2 is invalid
p389.cpp: In function 'int main()':
p389.cpp:114:11: error: ambiguous overload for 'operator*' (operand types are 'B<A>' and 'A')
  114 | B<A> b; b * a;
      |         ~ ^ ~
      |         |   |
      |         |   A
      |         B<A>
p389.cpp:28:25: note: candidate: 'int B<T>::operator*(R&) [with R = A; T = A]'
   28 |   template<class R> int operator*(R&);
      |                         ^~~~~~~~
p389.cpp:32:32: note: candidate: 'int operator*(T&, R&) [with T = B<A>; R = A]'
   32 | template<class T, class R> int operator*(T&, R&);
      |                                ^~~~~~~~
p389.cpp:118:6: error: call of overloaded 'g(int*&)' is ambiguous
  118 |     g(ip);
      |     ~^~~~
p389.cpp:45:29: note: candidate: 'void g(T) [with T = int*]'
   45 |      template<class T> void g(T);
      |                             ^
p389.cpp:46:29: note: candidate: 'void g(T&) [with T = int*]'
   46 |      template<class T> void g(T&);
      |                             ^
rm: cannot remove 'p389g': No such file or directory

$ g++ p389.cpp -std=c++2b -o p389g -I. -Wall
p389.cpp: In function 'void m()':
p389.cpp:52:3: error: 'x' was not declared in this scope
   52 | g(x); // ambiguous: g(T) or g(T&)
      |   ^
p389.cpp: At global scope:
p389.cpp:78:30: error: 'A' is not a template
   78 | template<class U> void f4(U, A<U, U>* p = 0);
      |                              ^
p389.cpp: In function 'void h4()':
p389.cpp:83:12: error: call of overloaded 'f4<int>(int)' is ambiguous
   83 |     f4<int>(42);
      |     ~~~~~~~^~~~
p389.cpp:77:33: note: candidate: 'void f4(U, A4<U, T>*) [with T = int; U = int]'
   77 | template<class T, class U> void f4(U, A4<U, T>* p = 0);
      |                                 ^~
p389.cpp:78:24: note: candidate: 'void f4(U, A*) [with U = int]'
   78 | template<class U> void f4(U, A<U, U>* p = 0);
      |                        ^~
p389.cpp: In function 'void h6()':
p389.cpp:107:24: error: use of deleted function 'bool operator==(X6<T, U6>, V) [with T = void*; U6 = int; V = int]'
  107 |   X6<void *, int>{} == 0;
      |                        ^
p389.cpp:104:46: note: declared here
  104 | template <typename T, C U6, typename V> bool operator==(X6<T, U6>, V) = delete;
      |                                              ^~~~~~~~
p389.cpp: In function 'int main()':
p389.cpp:114:11: error: ambiguous overload for 'operator*' (operand types are 'B<A>' and 'A')
  114 | B<A> b; b * a;
      |         ~ ^ ~
      |         |   |
      |         |   A
      |         B<A>
p389.cpp:28:25: note: candidate: 'int B<T>::operator*(R&) [with R = A; T = A]'
   28 |   template<class R> int operator*(R&);
      |                         ^~~~~~~~
p389.cpp:32:32: note: candidate: 'int operator*(T&, R&) [with T = B<A>; R = A]'
   32 | template<class T, class R> int operator*(T&, R&);
      |                                ^~~~~~~~
p389.cpp:118:6: error: call of overloaded 'g(int*&)' is ambiguous
  118 |     g(ip);
      |     ~^~~~
p389.cpp:45:29: note: candidate: 'void g(T) [with T = int*]'
   45 |      template<class T> void g(T);
      |                             ^
p389.cpp:46:29: note: candidate: 'void g(T&) [with T = int*]'
   46 |      template<class T> void g(T&);
      |                             ^

検討事項(agenda)

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

参考資料(reference)

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

コンパイラの実装状況

typedef は C++11 ではオワコン

C99からC++14を駆け抜けるC++講座

自己参照(self reference)

コピペコンパイルエラーあるある

C++ Error Message Collection(1)does not name a type, 11 articles

dockerにclang

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

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

Compare the contents of C++N4910:2022, C++N4741:2018 and C++N4606:2015

C++ sample list

clang++, g++コンパイルエラー方針の違いの例

astyle 使ってみた

C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da

Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f

C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff

Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d

cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67

MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed

ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1

C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9

'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11

Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc

MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb

どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00

MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671

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

文書履歴(document history)

ver. 0.01 初稿  20220705

0
0
0

Register as a new user and use Qiita more conveniently

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?