0
1

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.2 Template parameters [temp.param] C++N4910:2022 (198) p354.cpp

Last updated at Posted at 2022-07-03

はじめに(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.2 Template parameters [temp.param] C++N4910:2022 (198) p354.cpp

算譜(source code)

p354.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.2 Template parameters [temp.param] C++N4910:2022 (198) p354.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  
class T { /* ... */ };
int i;
template<class T, T i> void f(T t) {
T t1 = i; // template-parameters T and i
::T t2 = ::i; // global namespace members T and i
}
Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
// [Note 2: A template argument can be a class template or alias template. For example, template<class T> class myarray { /* ... */ };
     template<class K, class V, template<class T> class C = myarray>
     class Map {
C<K> key;
       C<V> value;
     };
// [Example 2:
  template<typename T> concept C1 = true;
  template<typename... Ts> concept C2 = true;
  template<typename T, typename U> concept C3 = true;
template<C1 T> struct s1;
template<C1... T> struct s2;
template<C2... T> struct s3;
template<C3<int> T> struct s4;
template<C3<int>... T> struct s5;
// associates // associates // associates // associates // associates
C1<T>
(C1<T> && ...)
(C2<T> && ...)
C3<T, int>
(C3<T, int> && ...)
[Example 3:
//      using X = int;
     struct A {};
     template<const X& x, int i, A a> void f() {
}
i++;
&x;
&i;
&a;
int& ri = i;
const int& cri = i;
const A& ra = a;
// error: change of template-parameter value
// OK
// error: address of non-reference template-parameter
// OK
// error: attempt to bind non-const reference to temporary // OK, const reference binds to temporary
// OK, const reference binds to a template parameter object
// [Example 4:
template<void v> class X; // error
template<void* pv> class Y; // OK 
// [Example 5:
template<int* a>   struct R { /* ... */ };
template<int b[5]> struct S { /* ... */ };
int p;
R<&p> w;
  S<&p> x;
  int v[5];
  R<v> y;
  S<v> z;
// OK
// OK due to parameter adjustment
// OK due to implicit argument conversion // OK due to both adjustment and conversion
// [Example 6:
template<class T1, class T2 = int> class A;
     template<class T1 = int, class T2> class A;
is equivalent to
     template<class T1 = int, class T2 = int> class A;
// [Example 7:
template<class T1 = int, class T2> class B; // error
// U can be neither deduced from the parameter-type-list nor specified template<class... T, class... U> void f() { } // error template<class... T, class U> void g() { } // error
//[Example 8:
  template<int i = 3 > 4 >
  class X { /* ... */ };
  template<int i = (3 > 4) >
  class Y { /* ... */ };
// syntax error // OK
// [Example 9:
     template <template <class TT = float> class T> struct A {
       inline void f();
       inline void g();
     };
     template <template <class TT> class T> void A<T>::f() {
T<> t; // error: TT has no default template argument }
template <template <class TT = char> class T> void A<T>::g() { T<> t; // OK, T<char>
}
// [Example 10:
template <class... Types>
class Tuple;
     template <class T, int... Dims>
        struct multi_array;
     template <class... T>
       struct value_holder {
         template <T... Values> struct apply { };
       };
     template <class... T, T... Values>
       struct static_array;
// Types is a template type parameter pack // but not a pack expansion
// Dims is a non-type template parameter pack // but not a pack expansion
// Values is a non-type template parameter pack // and a pack expansion
// error: Values expands template type parameter // pack T within the same template parameter list
int main(){
  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 p354
rm: cannot remove 'p354l': No such file or directory
rm: cannot remove 'p354g': No such file or directory
$ clang++ p354.cpp -std=c++03 -o p354l -I. -Wall
In file included from p354.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 \
 ^
p354.cpp:30:5: error: no viable conversion from 'int' to '::T'
::T t2 = ::i; // global namespace members T and i
    ^    ~~~
p354.cpp:26:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const T &' for 1st argument
class T { /* ... */ };
      ^
p354.cpp:32:1: error: C++ requires a type specifier for all declarations
Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
^
p354.cpp:32:10: error: expected ';' after top level declarator
Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
         ^
         ;
p354.cpp:40:24: error: unknown type name 'concept'
  template<typename T> concept C1 = true;
                       ^
p354.cpp:40:32: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  template<typename T> concept C1 = true;
                               ^
p354.cpp:41:20: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
  template<typename... Ts> concept C2 = true;
                   ^
p354.cpp:41:28: error: unknown type name 'concept'
  template<typename... Ts> concept C2 = true;
                           ^
p354.cpp:41:36: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  template<typename... Ts> concept C2 = true;
                                   ^
p354.cpp:42:36: error: unknown type name 'concept'
  template<typename T, typename U> concept C3 = true;
                                   ^
p354.cpp:42:44: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  template<typename T, typename U> concept C3 = true;
                                           ^
p354.cpp:43:10: error: unknown type name 'C1'
template<C1 T> struct s1;
         ^
p354.cpp:44:10: error: unknown type name 'C1'
template<C1... T> struct s2;
         ^
p354.cpp:44:12: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<C1... T> struct s2;
           ^
p354.cpp:45:10: error: unknown type name 'C2'
template<C2... T> struct s3;
         ^
p354.cpp:45:12: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<C2... T> struct s3;
           ^
p354.cpp:46:18: error: expected template parameter
template<C3<int> T> struct s4;
                 ^
p354.cpp:46:1: error: extraneous 'template<>' in declaration of struct 's4'
template<C3<int> T> struct s4;
^
p354.cpp:47:17: error: expected template parameter
template<C3<int>... T> struct s5;
                ^
p354.cpp:47:1: error: extraneous 'template<>' in declaration of struct 's5'
template<C3<int>... T> struct s5;
^
p354.cpp:50:2: error: expected parameter declarator
(C1<T> && ...)
 ^
p354.cpp:50:8: error: expected ')'
(C1<T> && ...)
       ^
p354.cpp:50:1: note: to match this '('
(C1<T> && ...)
^
p354.cpp:51:2: error: expected parameter declarator
(C2<T> && ...)
 ^
p354.cpp:51:8: error: expected ')'
(C2<T> && ...)
       ^
p354.cpp:51:1: note: to match this '('
(C2<T> && ...)
^
p354.cpp:52:1: error: expected function body after function declarator
C3<T, int>
^
6 warnings and 19 errors generated.
rm: cannot remove 'p354l': No such file or directory
$ clang++ p354.cpp -std=c++2b -o p354l -I. -Wall
p354.cpp:30:5: error: no viable conversion from 'int' to '::T'
::T t2 = ::i; // global namespace members T and i
    ^    ~~~
p354.cpp:26:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const T &' for 1st argument
class T { /* ... */ };
      ^
p354.cpp:26:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'T &&' for 1st argument
class T { /* ... */ };
      ^
p354.cpp:32:1: error: C++ requires a type specifier for all declarations
Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
^
p354.cpp:32:7: error: no template named 'the'; did you mean 'tie'?
Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
      ^~~
      tie
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1615:5: note: 'tie' declared here
    tie(_Elements&... __args) noexcept
    ^
p354.cpp:32:10: error: expected ';' after top level declarator
Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
         ^
         ;
p354.cpp:50:2: error: expected parameter declarator
(C1<T> && ...)
 ^
p354.cpp:50:8: error: expected ')'
(C1<T> && ...)
       ^
p354.cpp:50:1: note: to match this '('
(C1<T> && ...)
^
p354.cpp:51:2: error: expected parameter declarator
(C2<T> && ...)
 ^
p354.cpp:51:8: error: expected ')'
(C2<T> && ...)
       ^
p354.cpp:51:1: note: to match this '('
(C2<T> && ...)
^
p354.cpp:52:1: error: expected function body after function declarator
C3<T, int>
^
9 errors generated.

$ g++ p354.cpp -std=c++03 -o p354g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from p354.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 \
      |  ^~~~~
p354.cpp:32:1: error: 'Here' does not name a type
   32 | Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
      | ^~~~
p354.cpp:40:24: error: 'concept' does not name a type; did you mean 'const'?
   40 |   template<typename T> concept C1 = true;
      |                        ^~~~~~~
      |                        const
p354.cpp:40:24: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p354.cpp:41:20: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   41 |   template<typename... Ts> concept C2 = true;
      |                    ^~~
p354.cpp:41:28: error: 'concept' does not name a type; did you mean 'const'?
   41 |   template<typename... Ts> concept C2 = true;
      |                            ^~~~~~~
      |                            const
p354.cpp:41:28: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p354.cpp:42:36: error: 'concept' does not name a type; did you mean 'const'?
   42 |   template<typename T, typename U> concept C3 = true;
      |                                    ^~~~~~~
      |                                    const
p354.cpp:42:36: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p354.cpp:43:10: error: 'C1' has not been declared
   43 | template<C1 T> struct s1;
      |          ^~
p354.cpp:44:10: error: 'C1' has not been declared
   44 | template<C1... T> struct s2;
      |          ^~
p354.cpp:44:16: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   44 | template<C1... T> struct s2;
      |                ^
p354.cpp:45:10: error: 'C2' has not been declared
   45 | template<C2... T> struct s3;
      |          ^~
p354.cpp:45:16: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   45 | template<C2... T> struct s3;
      |                ^
p354.cpp:46:10: error: 'C3' has not been declared
   46 | template<C3<int> T> struct s4;
      |          ^~
p354.cpp:46:12: error: expected '>' before '<' token
   46 | template<C3<int> T> struct s4;
      |            ^
p354.cpp:47:10: error: 'C3' has not been declared
   47 | template<C3<int>... T> struct s5;
      |          ^~
p354.cpp:47:12: error: expected '>' before '<' token
   47 | template<C3<int>... T> struct s5;
      |            ^
p354.cpp:49:1: error: 'C1' does not name a type; did you mean 's1'?
   49 | C1<T>
      | ^~
      | s1
p354.cpp:57:21: error: 'X' does not name a type
   57 |      template<const X& x, int i, A a> void f() {
      |                     ^
p354.cpp:59:2: error: expected '>' before '++' token
   59 | i++;
      |  ^~
p354.cpp:59:4: error: expected unqualified-id before ';' token
   59 | i++;
      |    ^
p354.cpp:60:3: error: expected constructor, destructor, or type conversion before ';' token
   60 | &x;
      |   ^
p354.cpp:61:3: error: expected constructor, destructor, or type conversion before ';' token
   61 | &i;
      |   ^
p354.cpp:62:3: error: expected constructor, destructor, or type conversion before ';' token
   62 | &a;
      |   ^
p354.cpp:65:7: error: 'A' does not name a type
   65 | const A& ra = a;
      |       ^
p354.cpp:73:15: error: 'void' is not a valid type for a template non-type parameter
   73 | template<void v> class X; // error
      |               ^
p354.cpp:90:1: error: 'is' does not name a type
   90 | is equivalent to
      | ^~
p354.cpp:93:42: error: no default argument for 'T2'
   93 | template<class T1 = int, class T2> class B; // error
      |                                          ^
p354.cpp:96:24: error: expected unqualified-id before numeric constant
   96 |   template<int i = 3 > 4 >
      |                        ^
p354.cpp:74:16: error: template parameter 'void* pv'
   74 | template<void* pv> class Y; // OK
      |                ^~
p354.cpp:98:26: note: redeclared here as 'int i'
   98 |   template<int i = (3 > 4) >
      |                          ^
p354.cpp:102:60: error: redeclared with 1 template parameter
  102 |      template <template <class TT = float> class T> struct A {
      |                                                            ^
p354.cpp:88:42: note: previous declaration 'template<class T1, class T2> class A' used 2 template parameters
   88 | template<class T1, class T2 = int> class A;
      |                                          ^
p354.cpp:106:53: error: type/value mismatch at argument 1 in template parameter list for 'template<class T1, class T2> class A'
  106 |      template <template <class TT> class T> void A<T>::f() {
      |                                                     ^
p354.cpp:106:53: note:   expected a type, got 'T'
p354.cpp: In function 'void f()':
p354.cpp:107:3: error: wrong number of template arguments (0, should be 1)
  107 | T<> t; // error: TT has no default template argument }
      |   ^
p354.cpp:106:42: note: provided for 'template<class TT> class T'
  106 |      template <template <class TT> class T> void A<T>::f() {
      |                                          ^
p354.cpp:108:1: error: a template declaration cannot appear at block scope
  108 | template <template <class TT = char> class T> void A<T>::g() { T<> t; // OK, T<char>
      | ^~~~~~~~
p354.cpp:113:6: error: a template declaration cannot appear at block scope
  113 |      template <class T, int... Dims>
      |      ^~~~~~~~
p354.cpp:119:6: error: a template declaration cannot appear at block scope
  119 |      template <class... T, T... Values>
      |      ^~~~~~~~
p354.cpp:128:2: error: expected '}' at end of input
  128 | }
      |  ^
p354.cpp:106:60: note: to match this '{'
  106 |      template <template <class TT> class T> void A<T>::f() {
      |                                                            ^
rm: cannot remove 'p354g': No such file or directory

$ g++ p354.cpp -std=c++2b -o p354g -I. -Wall
p354.cpp:32:1: error: 'Here' does not name a type
   32 | Here, the template f has a type-parameter called T, rather than an unnamed non-type template-parameter of class T.
      | ^~~~
p354.cpp:49:1: error: specializing member '::C1<T>' requires 'template<>' syntax
   49 | C1<T>
      | ^~~~~
p354.cpp:57:21: error: 'X' does not name a type
   57 |      template<const X& x, int i, A a> void f() {
      |                     ^
p354.cpp:59:2: error: expected '>' before '++' token
   59 | i++;
      |  ^~
p354.cpp:59:4: error: expected unqualified-id before ';' token
   59 | i++;
      |    ^
p354.cpp:60:3: error: expected constructor, destructor, or type conversion before ';' token
   60 | &x;
      |   ^
p354.cpp:61:3: error: expected constructor, destructor, or type conversion before ';' token
   61 | &i;
      |   ^
p354.cpp:62:3: error: expected constructor, destructor, or type conversion before ';' token
   62 | &a;
      |   ^
p354.cpp:65:7: error: 'A' does not name a type
   65 | const A& ra = a;
      |       ^
p354.cpp:73:15: error: 'void' is not a valid type for a template non-type parameter
   73 | template<void v> class X; // error
      |               ^
p354.cpp:90:1: error: 'is' does not name a type
   90 | is equivalent to
      | ^~
p354.cpp:93:42: error: no default argument for 'T2'
   93 | template<class T1 = int, class T2> class B; // error
      |                                          ^
p354.cpp:96:24: error: expected unqualified-id before numeric constant
   96 |   template<int i = 3 > 4 >
      |                        ^
p354.cpp:74:16: error: template parameter 'void* pv'
   74 | template<void* pv> class Y; // OK
      |                ^~
p354.cpp:98:26: note: redeclared here as 'int i'
   98 |   template<int i = (3 > 4) >
      |                          ^
p354.cpp:102:60: error: redeclared with 1 template parameter
  102 |      template <template <class TT = float> class T> struct A {
      |                                                            ^
p354.cpp:88:42: note: previous declaration 'template<class T1, class T2> class A' used 2 template parameters
   88 | template<class T1, class T2 = int> class A;
      |                                          ^
p354.cpp:106:53: error: type/value mismatch at argument 1 in template parameter list for 'template<class T1, class T2> class A'
  106 |      template <template <class TT> class T> void A<T>::f() {
      |                                                     ^
p354.cpp:106:53: note:   expected a type, got 'T'
p354.cpp: In function 'void f()':
p354.cpp:107:3: error: wrong number of template arguments (0, should be 1)
  107 | T<> t; // error: TT has no default template argument }
      |   ^
p354.cpp:106:42: note: provided for 'template<class TT> class T'
  106 |      template <template <class TT> class T> void A<T>::f() {
      |                                          ^
p354.cpp:108:1: error: a template declaration cannot appear at block scope
  108 | template <template <class TT = char> class T> void A<T>::g() { T<> t; // OK, T<char>
      | ^~~~~~~~
p354.cpp:113:6: error: a template declaration cannot appear at block scope
  113 |      template <class T, int... Dims>
      |      ^~~~~~~~
p354.cpp:119:6: error: a template declaration cannot appear at block scope
  119 |      template <class... T, T... Values>
      |      ^~~~~~~~
p354.cpp:128:2: error: expected '}' at end of input
  128 | }
      |  ^
p354.cpp:106:60: note: to match this '{'
  106 |      template <template <class TT> class T> void A<T>::f() {
      | 

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

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?