LoginSignup
0
0

More than 1 year has passed since last update.

12.2.2.9 Class template argument deduction [over.match.class.deduct] C++N4910:2022 (184) p330.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.

12.2.2.9 Class template argument deduction [over.match.class.deduct] C++N4910:2022 (184) p330.cpp

算譜(source code)

p330.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 = "12.2.2.9 Class template argument deduction [over.match.class.deduct] C++N4910:2022 (184) p330.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
template <class T> struct A {
    explicit A(const T&, ...) noexcept;
    A(T&&, ...);
};
int i;
A a1 = { i, i };
A a2{i, i};
A a3{0, i};
A a4 = {0, i};
// error: explicit constructor #1 selected in copy-list-initialization during deduction, // cannot deduce from non-forwarding rvalue reference in #2
// OK, #1 deduces to A<int> and also initializes // OK, #2 deduces to A<int> and also initializes // OK, #2 deduces to A<int> and also initializes
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
A a5 = {0, 1};
A a6{0,1};
A a7 = {0, i};
A a8{0,i};
// error: explicit deduction guide #4 selected in copy-list-initialization during deduction // OK, #4 deduces to A<int> and #2 initializes
// error: #3 deduces to A<int&>, #1 and #2 declare same constructor
// error: #3 deduces to A<int&>, #1 and #2 declare same constructor
template <class T> struct B {
    template <class U> using TA = T;
    template <class U> B(U, TA<U>);
};
B b{(int*)0, (char*)0};
template <typename T>
struct S {
    T x;
    T y;
};
template <typename T>
struct C {
    S<T> s;
    T t;
};
// OK, deduces B<char*>
// #1 // #2
template <typename T>
struct D {
    S<int> s;
    T t;
};
Cc1= {1, 2};
Cc2= {1, 2, 3};
Cc3= {{1u, 2u}, 3};
Dd1= {1, 2};
Dd2= {1, 2, 3};
template <typename T>
struct E {
    T t;
    decltype(t) t2;
};
E e1 = {1, 2};
template <typename... T>
struct Types {};
// error: deduction failed error: deduction failed OK, deduces C<int>
// error: deduction failed
// OK, braces elided, deduces D<int>
// OK, deduces E<int>
template <typename... T>
struct F : Types<T...>, T... {};
struct X {};
struct Y {};
struct Z {};
struct W {
    operator Y();
};
F f1 = {Types<X, Y, Z>{}, {}, {}};
F f2 = {Types<X, Y, Z>{}, X{}, Y{}};
F f3 = {Types<X, Y, Z>{}, X{}, W{}};
// [Example 2:
template <class T, class U> struct C2 {
    C2(T, U);
};
template<class T, class U>
C2(T, U) -> C2<T, std::type_identity_t<U>>;
template<class V> using A2 = C2<V *, V *>;
template<std::integral W> using B2 = A2<W>;
int i2{};
double d{};
A2 a1(&i2, &i2);
A2 a2(i2, i2);
A2 a3(&i2, &d);
B2 b1(&i2, &i2);
B2 b2(&d, &d);
// deduces A<int>
// error: cannot deduce V * from i
// error: #1: cannot deduce (V*, V*) from (int *, double *) // #2: cannot deduce A<V> from C<int *, double *>
// deduces B<int>
// error: cannot deduce B<W> from C<double *, double *>
// Possible exposition-only implementation of the above procedure:
// The following concept ensures a specialization of A is deduced.
template <class> class AA;
template <class V> class AA<A2<V>> { };
template <class T> concept deduces_A = requires { sizeof(AA<T>); };
// OK, F<X, Y, Z> deduced
// OK, F<X, Y, Z> deduced
// error: conflicting types deduced; operator Y not considered
// #1 // #2
// f1 is formed from the constructor #1 of C, generating the following function template template<T, U>
auto f12(T, U) -> C2<T, U>;
// Deducing arguments for C<T, U> from C<V *, V*> deduces T as V * and U as V *; // f1’ is obtained by transforming f1 as described by the above procedure. template<class V> requires deduces_A<C<V *, V *>>
auto f1_prime(V *, V*) -> C2<V *, V *>;
// f2 is formed from the deduction-guide #2 of C
template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
// Deducing arguments for C2<T, std::type_identity_t<U>> from C<V *, V*> deduces T as V *; // f2’ is obtained by transforming f2 as described by the above procedure.
template<class V, class U>
requires deduces_A2<C2<V *, std::type_identity_t<U>>>
auto f2_prime(V *, U) -> C2<V *, std::type_identity_t<U>>;
// The following concept ensures a specialization of B is deduced.
template <class> class BB;
template <class V> class BB<B<V>> { };
template <class T> concept deduces_B = requires { sizeof(BB<T>); };
// The guides for B derived from the above f1’ and f2’ for A are as follows: template<std::integral W>
requires deduces_A2<C2<W *, W *>> && deduces_B2<C2<W *, W *>>
                               auto f1_prime_for_B2(W *, W *) -> C2<W *, W *>;
template<std::integral W, class U>
requires deduces_A2<C2<W *, std::type_identity_t<U>>> &&
deduces_B2<C2<W *, std::type_identity_t<U>>>
auto f2_prime_for_B2(W *, U) -> C2<W *, std::type_identity_t<U>>;
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 p330
rm: cannot remove 'p330l': No such file or directory
rm: cannot remove 'p330g': No such file or directory
$ clang++ p330.cpp -std=c++03 -o p330l -I. -Wall
In file included from p330.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 \
 ^
p330.cpp:27:35: error: expected ';' at end of declaration list
         explicit A(const T&, ...) noexcept;
                                  ^
                                  ;
p330.cpp:28:13: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
         A(T&&, ...);
            ^
p330.cpp:31:1: error: use of class template 'A' requires template arguments
A a1 = { i, i };
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:32:1: error: use of class template 'A' requires template arguments
A a2{i, i};
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:32:5: error: expected ';' after top level declarator
A a2{i, i};
    ^
    ;
p330.cpp:33:1: error: use of class template 'A' requires template arguments
A a3{0, i};
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:33:5: error: expected ';' after top level declarator
A a3{0, i};
    ^
    ;
p330.cpp:34:1: error: use of class template 'A' requires template arguments
A a4 = {0, i};
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:37:20: error: C++ requires a type specifier for all declarations
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
                   ^
p330.cpp:37:41: error: expected ';' at end of declaration
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
                                        ^
                                        ;
p330.cpp:37:42: error: cannot use arrow operator on a type
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
                                         ^
p330.cpp:38:1: error: use of class template 'A' requires template arguments
A a5 = {0, 1};
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:39:1: error: use of class template 'A' requires template arguments
A a6{0,1};
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:39:5: error: expected ';' after top level declarator
A a6{0,1};
    ^
    ;
p330.cpp:40:1: error: use of class template 'A' requires template arguments
A a7 = {0, i};
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:41:1: error: use of class template 'A' requires template arguments
A a8{0,i};
^
p330.cpp:26:34: note: template is declared here
       template <class T> struct A {
       ~~~~~~~~~~~~~~~~~~        ^
p330.cpp:41:5: error: expected ';' after top level declarator
A a8{0,i};
    ^
    ;
p330.cpp:46:33: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
  template <class U> using TA = T;
                                ^
p330.cpp:49:1: error: use of class template 'B' requires template arguments
B b{(int*)0, (char*)0};
^
p330.cpp:45:27: note: template is declared here
template <class T> struct B {
~~~~~~~~~~~~~~~~~~        ^
p330.cpp:49:4: error: expected ';' after top level declarator
B b{(int*)0, (char*)0};
   ^
   ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
rm: cannot remove 'p330l': No such file or directory
$ clang++ p330.cpp -std=c++2b -o p330l -I. -Wall
p330.cpp:31:3: error: class template argument deduction for 'A' selected an explicit constructor for copy-list-initialization
A a1 = { i, i };
  ^
p330.cpp:27:19: note: explicit constructor declared here
         explicit A(const T&, ...) noexcept;
                  ^
p330.cpp:38:3: error: ambiguous deduction for template arguments of 'A'
A a5 = {0, 1};
  ^
p330.cpp:28:10: note: candidate function [with T = int]
         A(T&&, ...);
         ^
p330.cpp:37:20: note: candidate function [with T = int]
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
                   ^
p330.cpp:39:3: error: ambiguous deduction for template arguments of 'A'
A a6{0,1};
  ^
p330.cpp:28:10: note: candidate function [with T = int]
         A(T&&, ...);
         ^
p330.cpp:37:20: note: candidate function [with T = int]
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
                   ^
p330.cpp:40:3: error: ambiguous deduction for template arguments of 'A'
A a7 = {0, i};
  ^
p330.cpp:28:10: note: candidate function [with T = int]
         A(T&&, ...);
         ^
p330.cpp:37:20: note: candidate function [with T = int]
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
                   ^
p330.cpp:41:3: error: ambiguous deduction for template arguments of 'A'
A a8{0,i};
  ^
p330.cpp:28:10: note: candidate function [with T = int]
         A(T&&, ...);
         ^
p330.cpp:37:20: note: candidate function [with T = int]
template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
                   ^
p330.cpp:64:1: error: C++ requires a type specifier for all declarations
Cc1= {1, 2};
^
p330.cpp:65:1: error: C++ requires a type specifier for all declarations
Cc2= {1, 2, 3};
^
p330.cpp:66:1: error: C++ requires a type specifier for all declarations
Cc3= {{1u, 2u}, 3};
^
p330.cpp:67:1: error: C++ requires a type specifier for all declarations
Dd1= {1, 2};
^
p330.cpp:68:1: error: C++ requires a type specifier for all declarations
Dd2= {1, 2, 3};
^
p330.cpp:74:3: error: no viable constructor or deduction guide for deduction of template arguments of 'E'
E e1 = {1, 2};
  ^
p330.cpp:70:8: note: candidate function template not viable: requires 1 argument, but 2 were provided
struct E {
       ^
p330.cpp:70:8: note: candidate function template not viable: requires 0 arguments, but 2 were provided
p330.cpp:87:8: error: no viable constructor or deduction guide for deduction of template arguments of 'F'
     F f1 = {Types<X, Y, Z>{}, {}, {}};
       ^
p330.cpp:82:13: note: candidate function template not viable: requires 1 argument, but 3 were provided
     struct F : Types<T...>, T... {};
            ^
p330.cpp:82:13: note: candidate function template not viable: requires 0 arguments, but 3 were provided
p330.cpp:88:8: error: no viable constructor or deduction guide for deduction of template arguments of 'F'
     F f2 = {Types<X, Y, Z>{}, X{}, Y{}};
       ^
p330.cpp:82:13: note: candidate function template not viable: requires 1 argument, but 3 were provided
     struct F : Types<T...>, T... {};
            ^
p330.cpp:82:13: note: candidate function template not viable: requires 0 arguments, but 3 were provided
p330.cpp:89:8: error: no viable constructor or deduction guide for deduction of template arguments of 'F'
     F f3 = {Types<X, Y, Z>{}, X{}, W{}};
       ^
p330.cpp:82:13: note: candidate function template not viable: requires 1 argument, but 3 were provided
     struct F : Types<T...>, T... {};
            ^
p330.cpp:82:13: note: candidate function template not viable: requires 0 arguments, but 3 were provided
p330.cpp:100:4: error: redefinition of 'a1'
A2 a1(&i2, &i2);
   ^
p330.cpp:31:3: note: previous definition is here
A a1 = { i, i };
  ^
p330.cpp:101:4: error: redefinition of 'a2'
A2 a2(i2, i2);
   ^
p330.cpp:32:3: note: previous definition is here
A a2{i, i};
  ^
p330.cpp:102:4: error: redefinition of 'a3'
A2 a3(&i2, &d);
   ^
p330.cpp:33:3: note: previous definition is here
A a3{0, i};
  ^
p330.cpp:103:4: error: alias template 'B2' requires template arguments; argument deduction only allowed for class templates
B2 b1(&i2, &i2);
   ^
p330.cpp:97:32: note: template is declared here
     template<std::integral W> using B2 = A2<W>;
                               ^
p330.cpp:104:4: error: alias template 'B2' requires template arguments; argument deduction only allowed for class templates
B2 b2(&d, &d);
   ^
p330.cpp:97:32: note: template is declared here
     template<std::integral W> using B2 = A2<W>;
                               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p330.cpp -std=c++03 -o p330g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from p330.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 \
      |  ^~~~~
p330.cpp:27:36: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   27 |          explicit A(const T&, ...) noexcept;
      |                                    ^~~~~~~~
p330.cpp:72:3: warning: identifier 'decltype' is a keyword in C++11 [-Wc++11-compat]
   72 |   decltype(t) t2;
      |   ^~~~~~~~
p330.cpp:27:34: error: expected ';' at end of member declaration
   27 |          explicit A(const T&, ...) noexcept;
      |                                  ^
      |                                   ;
p330.cpp:27:36: error: 'noexcept' does not name a type
   27 |          explicit A(const T&, ...) noexcept;
      |                                    ^~~~~~~~
p330.cpp:27:36: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p330.cpp:28:13: error: expected ',' or '...' before '&&' token
   28 |          A(T&&, ...);
      |             ^~
p330.cpp:31:1: error: invalid use of template-name 'A' without an argument list
   31 | A a1 = { i, i };
      | ^
p330.cpp:31:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:32:1: error: invalid use of template-name 'A' without an argument list
   32 | A a2{i, i};
      | ^
p330.cpp:32:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:33:1: error: invalid use of template-name 'A' without an argument list
   33 | A a3{0, i};
      | ^
p330.cpp:33:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:34:1: error: invalid use of template-name 'A' without an argument list
   34 | A a4 = {0, i};
      | ^
p330.cpp:34:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:37:50: error: expected constructor, destructor, or type conversion before ';' token
   37 | template <class T> A(const T&, const T&) -> A<T&>; // #3 template <class T> explicit A(T&&, T&&) -> A<T>; // #4
      |                                                  ^
p330.cpp:38:1: error: invalid use of template-name 'A' without an argument list
   38 | A a5 = {0, 1};
      | ^
p330.cpp:38:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:39:1: error: invalid use of template-name 'A' without an argument list
   39 | A a6{0,1};
      | ^
p330.cpp:39:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:40:1: error: invalid use of template-name 'A' without an argument list
   40 | A a7 = {0, i};
      | ^
p330.cpp:40:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:41:1: error: invalid use of template-name 'A' without an argument list
   41 | A a8{0,i};
      | ^
p330.cpp:41:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:26:34: note: 'template<class T> struct A' declared here
   26 |        template <class T> struct A {
      |                                  ^
p330.cpp:46:22: error: expected unqualified-id before 'using'
   46 |   template <class U> using TA = T;
      |                      ^~~~~
p330.cpp:47:27: error: 'TA' has not been declared
   47 |   template <class U> B(U, TA<U>);
      |                           ^~
p330.cpp:47:29: error: expected ',' or '...' before '<' token
   47 |   template <class U> B(U, TA<U>);
      |                             ^
p330.cpp:49:1: error: invalid use of template-name 'B' without an argument list
   49 | B b{(int*)0, (char*)0};
      | ^
p330.cpp:49:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:45:27: note: 'template<class T> struct B' declared here
   45 | template <class T> struct B {
      |                           ^
p330.cpp:64:1: error: 'Cc1' does not name a type
   64 | Cc1= {1, 2};
      | ^~~
p330.cpp:65:1: error: 'Cc2' does not name a type
   65 | Cc2= {1, 2, 3};
      | ^~~
p330.cpp:66:1: error: 'Cc3' does not name a type
   66 | Cc3= {{1u, 2u}, 3};
      | ^~~
p330.cpp:67:1: error: 'Dd1' does not name a type
   67 | Dd1= {1, 2};
      | ^~~
p330.cpp:68:1: error: 'Dd2' does not name a type
   68 | Dd2= {1, 2, 3};
      | ^~~
p330.cpp:72:12: error: 't' is not a type
   72 |   decltype(t) t2;
      |            ^
p330.cpp:72:3: error: ISO C++ forbids declaration of 'decltype' with no type [-fpermissive]
   72 |   decltype(t) t2;
      |   ^~~~~~~~
p330.cpp:72:13: error: expected ';' at end of member declaration
   72 |   decltype(t) t2;
      |             ^
      |              ;
p330.cpp:72:15: error: 't2' does not name a type; did you mean 'tm'?
   72 |   decltype(t) t2;
      |               ^~
      |               tm
p330.cpp:74:1: error: invalid use of template-name 'E' without an argument list
   74 | E e1 = {1, 2};
      | ^
p330.cpp:74:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:70:8: note: 'template<class T> struct E' declared here
   70 | struct E {
      |        ^
p330.cpp:75:19: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   75 | template <typename... T>
      |                   ^~~
p330.cpp:81:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   81 |      template <typename... T>
      |                        ^~~
p330.cpp:87:6: error: invalid use of template-name 'F' without an argument list
   87 |      F f1 = {Types<X, Y, Z>{}, {}, {}};
      |      ^
p330.cpp:87:6: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:82:13: note: 'template<class ... T> struct F' declared here
   82 |      struct F : Types<T...>, T... {};
      |             ^
p330.cpp:88:6: error: invalid use of template-name 'F' without an argument list
   88 |      F f2 = {Types<X, Y, Z>{}, X{}, Y{}};
      |      ^
p330.cpp:88:6: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:82:13: note: 'template<class ... T> struct F' declared here
   82 |      struct F : Types<T...>, T... {};
      |             ^
p330.cpp:89:6: error: invalid use of template-name 'F' without an argument list
   89 |      F f3 = {Types<X, Y, Z>{}, X{}, W{}};
      |      ^
p330.cpp:89:6: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:82:13: note: 'template<class ... T> struct F' declared here
   82 |      struct F : Types<T...>, T... {};
      |             ^
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                               ^~~~~~~~~~~~~~~
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:48: error: template argument 2 is invalid
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                ^~
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                               ^~~~~~~~~~~~~~~
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:48: error: template argument 2 is invalid
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                ^~
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                               ^~~~~~~~~~~~~~~
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:48: error: template argument 2 is invalid
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                ^~
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                               ^~~~~~~~~~~~~~~
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:31: error: 'type_identity_t' is not a member of 'std'
p330.cpp:95:31: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:95:48: error: template argument 2 is invalid
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                ^~
p330.cpp:95:20: error: invalid use of template-name 'C2' without an argument list
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                    ^~
p330.cpp:95:20: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:91:41: note: 'template<class T, class U> struct C2' declared here
   91 |      template <class T, class U> struct C2 {
      |                                         ^~
p330.cpp:95:22: error: expected constructor, destructor, or type conversion before '<' token
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |                      ^
p330.cpp:96:24: error: expected unqualified-id before 'using'
   96 |      template<class V> using A2 = C2<V *, V *>;
      |                        ^~~~~
p330.cpp:97:20: error: 'std::integral' has not been declared
   97 |      template<std::integral W> using B2 = A2<W>;
      |                    ^~~~~~~~
p330.cpp:97:32: error: expected unqualified-id before 'using'
   97 |      template<std::integral W> using B2 = A2<W>;
      |                                ^~~~~
p330.cpp:98:7: warning: extended initializer lists only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   98 | int i2{};
      |       ^
p330.cpp:98:8: warning: extended initializer lists only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   98 | int i2{};
      |        ^
p330.cpp:99:9: warning: extended initializer lists only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   99 | double d{};
      |         ^
p330.cpp:99:10: warning: extended initializer lists only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   99 | double d{};
      |          ^
p330.cpp:100:1: error: 'A2' does not name a type; did you mean 'C2'?
  100 | A2 a1(&i2, &i2);
      | ^~
      | C2
p330.cpp:101:1: error: 'A2' does not name a type; did you mean 'C2'?
  101 | A2 a2(i2, i2);
      | ^~
      | C2
p330.cpp:102:1: error: 'A2' does not name a type; did you mean 'C2'?
  102 | A2 a3(&i2, &d);
      | ^~
      | C2
p330.cpp:103:1: error: 'B2' does not name a type; did you mean 'C2'?
  103 | B2 b1(&i2, &i2);
      | ^~
      | C2
p330.cpp:104:1: error: 'B2' does not name a type; did you mean 'C2'?
  104 | B2 b2(&d, &d);
      | ^~
      | C2
p330.cpp:113:29: error: 'A2' was not declared in this scope; did you mean 'i2'?
  113 | template <class V> class AA<A2<V>> { };
      |                             ^~
      |                             i2
p330.cpp:113:33: error: template argument 1 is invalid
  113 | template <class V> class AA<A2<V>> { };
      |                                 ^~
p330.cpp:114:20: error: 'concept' does not name a type; did you mean 'const'?
  114 | template <class T> concept deduces_A = requires { sizeof(AA<T>); };
      |                    ^~~~~~~
      |                    const
p330.cpp:114:20: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p330.cpp:120:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  120 |     auto f12(T, U) -> C2<T, U>;
      |     ^~~~
      |     ----
p330.cpp:120:10: error: ISO C++ forbids declaration of 'f12' with no type [-fpermissive]
  120 |     auto f12(T, U) -> C2<T, U>;
      |          ^~~
p330.cpp:120:5: error: top-level declaration of 'f12' specifies 'auto'
  120 |     auto f12(T, U) -> C2<T, U>;
      |     ^~~~
p330.cpp:120:14: error: 'T' was not declared in this scope
  120 |     auto f12(T, U) -> C2<T, U>;
      |              ^
p330.cpp:120:17: error: 'U' was not declared in this scope
  120 |     auto f12(T, U) -> C2<T, U>;
      |                 ^
p330.cpp:120:18: error: expression list treated as compound expression in initializer [-fpermissive]
  120 |     auto f12(T, U) -> C2<T, U>;
      |                  ^
p330.cpp:122:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |     ^~~~
      |     ----
p330.cpp:122:10: error: ISO C++ forbids declaration of 'f1_prime' with no type [-fpermissive]
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |          ^~~~~~~~
p330.cpp:122:5: error: top-level declaration of 'f1_prime' specifies 'auto'
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |     ^~~~
p330.cpp:122:19: error: 'V' was not declared in this scope
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                   ^
p330.cpp:122:22: error: expected primary-expression before ',' token
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                      ^
p330.cpp:122:24: error: 'V' was not declared in this scope
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                        ^
p330.cpp:122:26: error: expected primary-expression before ')' token
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                          ^
p330.cpp:122:26: error: expression list treated as compound expression in initializer [-fpermissive]
p330.cpp:124:28: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                            ^~~~
      |                            ----
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                         ^~~~~~~~~~~~~~~
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:74: error: template argument 2 is invalid
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                                          ^~
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                         ^~~~~~~~~~~~~~~
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:74: error: template argument 2 is invalid
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                                          ^~
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                         ^~~~~~~~~~~~~~~
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:74: error: template argument 2 is invalid
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                                          ^~
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                         ^~~~~~~~~~~~~~~
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:57: error: 'type_identity_t' is not a member of 'std'
p330.cpp:124:57: note: 'std::type_identity_t' is only available from C++20 onwards
p330.cpp:124:74: error: template argument 2 is invalid
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                                          ^~
p330.cpp:124:46: error: invalid use of template-name 'C2' without an argument list
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                              ^~
p330.cpp:124:46: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
p330.cpp:91:41: note: 'template<class T, class U> struct C2' declared here
   91 |      template <class T, class U> struct C2 {
      |                                         ^~
p330.cpp:124:48: error: expected initializer before '<' token
  124 | template<class T, class U> auto f22(T, U) -> C2<T, std::type_identity_t<U>>;
      |                                                ^
p330.cpp:127:5: error: 'requires' does not name a type
  127 |     requires deduces_A2<C2<V *, std::type_identity_t<U>>>
      |     ^~~~~~~~
p330.cpp:127:5: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p330.cpp:131:32: error: '>>' should be '> >' within a nested template argument list
  131 | template <class V> class BB<B<V>> { };
      |                                ^~
      |                                > >
p330.cpp:132:20: error: 'concept' does not name a type; did you mean 'const'?
  132 | template <class T> concept deduces_B = requires { sizeof(BB<T>); };
      |                    ^~~~~~~
      |                    const
p330.cpp:132:20: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p330.cpp:134:5: error: 'requires' does not name a type
  134 |     requires deduces_A2<C2<W *, W *>> && deduces_B2<C2<W *, W *>>
      |     ^~~~~~~~
p330.cpp:134:5: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p330.cpp:136:17: error: 'std::integral' has not been declared
  136 |   template<std::integral W, class U>
      |                 ^~~~~~~~
p330.cpp:137:5: error: 'requires' does not name a type
  137 |     requires deduces_A2<C2<W *, std::type_identity_t<U>>> &&
      |     ^~~~~~~~
p330.cpp:137:5: note: 'requires' only available with '-std=c++20' or '-fconcepts'
rm: cannot remove 'p330g': No such file or directory

$ g++ p330.cpp -std=c++2b -o p330g -I. -Wall
p330.cpp:31:15: error: class template argument deduction for 'A<T>' failed: explicit deduction guide selected in copy-list-initialization
   31 | A a1 = { i, i };
      |               ^
p330.cpp:27:19: note: explicit deduction guide declared here
   27 |          explicit A(const T&, ...) noexcept;
      |                   ^
p330.cpp:38:13: error: class template argument deduction failed:
   38 | A a5 = {0, 1};
      |             ^
p330.cpp:39:9: error: class template argument deduction failed:
   39 | A a6{0,1};
      |         ^
p330.cpp:40:13: error: class template argument deduction failed:
   40 | A a7 = {0, i};
      |             ^
p330.cpp:41:9: error: class template argument deduction failed:
   41 | A a8{0,i};
      |         ^
p330.cpp:64:1: error: 'Cc1' does not name a type
   64 | Cc1= {1, 2};
      | ^~~
p330.cpp:65:1: error: 'Cc2' does not name a type
   65 | Cc2= {1, 2, 3};
      | ^~~
p330.cpp:66:1: error: 'Cc3' does not name a type
   66 | Cc3= {{1u, 2u}, 3};
      | ^~~
p330.cpp:67:1: error: 'Dd1' does not name a type
   67 | Dd1= {1, 2};
      | ^~~
p330.cpp:68:1: error: 'Dd2' does not name a type
   68 | Dd2= {1, 2, 3};
      | ^~~
p330.cpp:89:40: error: class template argument deduction failed:
   89 |      F f3 = {Types<X, Y, Z>{}, X{}, W{}};
      |                                        ^
p330.cpp:89:40: error: no matching function for call to 'F(Types<X, Y, Z>, X, W)'
p330.cpp:82:13: note: candidate: 'template<class ... T> F()-> F<T>'
   82 |      struct F : Types<T...>, T... {};
      |             ^
p330.cpp:82:13: note:   template argument deduction/substitution failed:
p330.cpp:89:40: note:   candidate expects 0 arguments, 3 provided
   89 |      F f3 = {Types<X, Y, Z>{}, X{}, W{}};
      |                                        ^
p330.cpp:82:13: note: candidate: 'template<class ... T> F(F<T>)-> F<T>'
   82 |      struct F : Types<T...>, T... {};
      |             ^
p330.cpp:82:13: note:   template argument deduction/substitution failed:
p330.cpp:89:40: note:   'Types<X, Y, Z>' is not derived from 'F<T>'
   89 |      F f3 = {Types<X, Y, Z>{}, X{}, W{}};
      |                                        ^
p330.cpp:82:13: note: candidate: 'template<class ... T> F(Types<T ...>, T ...)-> F<T>'
   82 |      struct F : Types<T...>, T... {};
      |             ^
p330.cpp:82:13: note:   template argument deduction/substitution failed:
p330.cpp:89:40: note:   inconsistent parameter pack deduction with 'Y' and 'W'
   89 |      F f3 = {Types<X, Y, Z>{}, X{}, W{}};
      |                                        ^
p330.cpp:101:4: error: conflicting declaration 'A2<...auto...> a2'
  101 | A2 a2(i2, i2);
      |    ^~
p330.cpp:32:3: note: previous declaration as 'A<int> a2'
   32 | A a2{i, i};
      |   ^~
p330.cpp:102:4: error: conflicting declaration 'A2<...auto...> a3'
  102 | A2 a3(&i2, &d);
      |    ^~
p330.cpp:33:3: note: previous declaration as 'A<int> a3'
   33 | A a3{0, i};
      |   ^~
p330.cpp:104:13: error: class template argument deduction failed:
  104 | B2 b2(&d, &d);
      |             ^
p330.cpp:104:13: error: no matching function for call to 'C2(double*, double*)'
p330.cpp:95:8: note: candidate: 'template<class W, class U> C2(V*, U)-> C2<V*, typename std::type_identity<U>::type> requires  __is_same(B2<W>, C2<V*, typename std::type_identity<U>::type>'
   95 |        C2(T, U) -> C2<T, std::type_identity_t<U>>;
      |        ^~
p330.cpp:95:8: note:   template argument deduction/substitution failed:
p330.cpp:95:8: note: constraints not satisfied
p330.cpp: In substitution of 'template<class W, class U> C2(V*, U)-> C2<V*, typename std::type_identity<U>::type> requires  __is_same(B2<W>, C2<V*, typename std::type_identity<U>::type>) [with W = double; U = double*]':
p330.cpp:104:13:   required from here
p330.cpp:95:8:   required by the constraints of 'template<class W, class U> C2(V*, U)-> C2<V*, typename std::type_identity<U>::type> requires  __is_same(B2<W>, C2<V*, typename std::type_identity<U>::type>)'
p330.cpp:95:8: error: template constraint failure for 'template<class W>  requires  integral<W> using B2 = A2<W>'
p330.cpp:95:8: note: constraints not satisfied
In file included from /usr/local/include/c++/12.1.0/compare:39,
                 from /usr/local/include/c++/12.1.0/bits/char_traits.h:45,
                 from /usr/local/include/c++/12.1.0/ios:40,
                 from /usr/local/include/c++/12.1.0/ostream:38,
                 from /usr/local/include/c++/12.1.0/iostream:39,
                 from p330.cpp:10:
/usr/local/include/c++/12.1.0/concepts: In substitution of 'template<class W>  requires  integral<W> using B2 = A2<W> [with W = double]':
p330.cpp:95:8:   required by substitution of 'template<class W, class U> C2(V*, U)-> C2<V*, typename std::type_identity<U>::type> requires  __is_same(B2<W>, C2<V*, typename std::type_identity<U>::type>) [with W = double; U = double*]'
p330.cpp:104:13:   required from here
/usr/local/include/c++/12.1.0/concepts:100:13:   required for the satisfaction of 'integral<W>' [with W = double]
/usr/local/include/c++/12.1.0/concepts:100:24: note: the expression 'is_integral_v<_Tp> [with _Tp = double]' evaluated to 'false'
  100 |     concept integral = is_integral_v<_Tp>;
      |                        ^~~~~~~~~~~~~~~~~~
p330.cpp:91:41: note: candidate: 'template<class W> C2(C2<V*, V*>)-> C2<V*, V*> requires  __is_same(B2<W>, C2<V*, V*>)'
   91 |      template <class T, class U> struct C2 {
      |                                         ^~
p330.cpp:91:41: note:   template argument deduction/substitution failed:
p330.cpp:104:13: note:   mismatched types 'C2<V*, V*>' and 'double*'
  104 | B2 b2(&d, &d);
      |             ^
p330.cpp:92:8: note: candidate: 'template<class W> C2(V*, V*)-> C2<V*, V*> requires  __is_same(B2<W>, C2<V*, V*>)'
   92 |        C2(T, U);
      |        ^~
p330.cpp:92:8: note:   template argument deduction/substitution failed:
p330.cpp:92:8: note: constraints not satisfied
p330.cpp: In substitution of 'template<class W> C2(V*, V*)-> C2<V*, V*> requires  __is_same(B2<W>, C2<V*, V*>) [with W = double]':
p330.cpp:104:13:   required from here
p330.cpp:92:8:   required by the constraints of 'template<class W> C2(V*, V*)-> C2<V*, V*> requires  __is_same(B2<W>, C2<V*, V*>)'
p330.cpp:92:8: error: template constraint failure for 'template<class W>  requires  integral<W> using B2 = A2<W>'
p330.cpp:92:8: note: constraints not satisfied
/usr/local/include/c++/12.1.0/concepts: In substitution of 'template<class W>  requires  integral<W> using B2 = A2<W> [with W = double]':
p330.cpp:92:8:   required by substitution of 'template<class W> C2(V*, V*)-> C2<V*, V*> requires  __is_same(B2<W>, C2<V*, V*>) [with W = double]'
p330.cpp:104:13:   required from here
/usr/local/include/c++/12.1.0/concepts:100:13:   required for the satisfaction of 'integral<W>' [with W = double]
/usr/local/include/c++/12.1.0/concepts:100:24: note: the expression 'is_integral_v<_Tp> [with _Tp = double]' evaluated to 'false'
  100 |     concept integral = is_integral_v<_Tp>;
      |                        ^~~~~~~~~~~~~~~~~~
p330.cpp:120:14: error: 'T' was not declared in this scope
  120 |     auto f12(T, U) -> C2<T, U>;
      |              ^
p330.cpp:120:17: error: 'U' was not declared in this scope
  120 |     auto f12(T, U) -> C2<T, U>;
      |                 ^
p330.cpp:120:18: error: expression list treated as compound expression in initializer [-fpermissive]
  120 |     auto f12(T, U) -> C2<T, U>;
      |                  ^
p330.cpp:120:20: error: expected ',' or ';' before '->' token
  120 |     auto f12(T, U) -> C2<T, U>;
      |                    ^~
p330.cpp:122:19: error: 'V' was not declared in this scope
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                   ^
p330.cpp:122:22: error: expected primary-expression before ',' token
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                      ^
p330.cpp:122:24: error: 'V' was not declared in this scope
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                        ^
p330.cpp:122:26: error: expected primary-expression before ')' token
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                          ^
p330.cpp:122:26: error: expression list treated as compound expression in initializer [-fpermissive]
p330.cpp:122:28: error: expected ',' or ';' before '->' token
  122 |     auto f1_prime(V *, V*) -> C2<V *, V *>;
      |                            ^~
p330.cpp:127:14: error: 'deduces_A2' was not declared in this scope; did you mean 'deduces_A'?
  127 |     requires deduces_A2<C2<V *, std::type_identity_t<U>>>
      |              ^~~~~~~~~~
      |              deduces_A
p330.cpp:127:5: error: expression must be enclosed in parentheses
  127 |     requires deduces_A2<C2<V *, std::type_identity_t<U>>>
      |     ^~~~~~~~
p330.cpp:127:14: error: 'deduces_A2' does not name a type
  127 |     requires deduces_A2<C2<V *, std::type_identity_t<U>>>
      |              ^~~~~~~~~~
p330.cpp:134:5: error: expected unqualified-id before 'requires'
  134 |     requires deduces_A2<C2<W *, W *>> && deduces_B2<C2<W *, W *>>
      |     ^~~~~~~~
p330.cpp:137:14: error: 'deduces_A2' was not declared in this scope; did you mean 'deduces_A'?
  137 |     requires deduces_A2<C2<W *, std::type_identity_t<U>>> &&
      |              ^~~~~~~~~~
      |              deduces_A
p330.cpp:138:7: error: label 'deduces_B2' referenced outside of any function
  138 |       deduces_B2<C2<W *, std::type_identity_t<U>>>
      |       ^~~~~~~~~~
p330.cpp:137:5: error: expression must be enclosed in parentheses
  137 |     requires deduces_A2<C2<W *, std::type_identity_t<U>>> &&
      |     ^~~~~~~~
p330.cpp:137:14: error: 'deduces_A2' does not name a type
  137 |     requires deduces_A2<C2<W *, std::type_identity_t<U>>> &&
      |              ^~~~~~~~~~

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