comparison gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-2.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // { dg-do compile { target c++11 } }
2 // { dg-options "-fconcepts" }
3
4 template <typename T>
5 void foo1(T& t) {
6 typename T::template C<void> tcv = t;
7 typename T::template C<auto> u = tcv;
8 T::template C<auto>::f (tcv, u); // { dg-error "incomplete" }
9 (typename T::template D<auto> (t)); // { dg-error "invalid" }
10 }
11
12 struct T1 {
13 template <typename T> struct C {
14 C(T1&);
15 static void f(T1&, C&);
16 };
17 template <typename T> struct D {
18 D(T1&);
19 };
20 };
21
22 template <typename T>
23 void foo2(T& t) {
24 typename T::template C<void> tcv = t;
25 typename T::template C<auto> u = tcv;
26 T::template C<auto>::f (tcv, u); // { dg-error "incomplete" }
27 T::template D<auto> (t); // { dg-error "invalid" }
28 }
29
30 struct T2 {
31 template <typename T> struct C {
32 C(T2&);
33 static void f(T2&, C&);
34 };
35 template <typename T> static void D(T2&);
36 };
37
38 void f(T1& t1, T2& t2) {
39 foo1 (t1);
40 foo2 (t2);
41 }