Debian Codegraph @

gcc/testsuite/g++.dg/DRs/dr2303.C

raw
1 // DR 2303
2 // PR c++/97453
3 // { dg-do compile { target c++11 } }
4
5 template <typename... T> struct A;
6 template <> struct A<>
7 {
8 };
9 template <typename T, typename... Ts> struct A<T, Ts...> : A<Ts...>
10 {
11 };
12 struct B : A<int, int>
13 {
14 };
15
16 struct C : A<int, int>, A<int> // { dg-warning "direct base .A<int>. inaccessible in .C. due to ambiguity" }
17 {
18 };
19
20 struct D : A<int>, A<int, int> // { dg-warning "direct base .A<int>. inaccessible in .D. due to ambiguity" }
21 {
22 };
23 template <typename... T>
24 void
25 f (const A<T...> &)
26 {
27 static_assert (sizeof...(T) == 2, "it should duduce to A<int,int>");
28 }
29
30
31 void
32 g ()
33 {
34 f (B{});
35 f (C{});
36 f (D{});
37 }