Debian Codegraph @

gcc/testsuite/g++.dg/other/abstract2.C

raw
1 // { dg-do compile }
2 // Contributed by Gabriel Dos Reis <gdr at integrable-solutions dot net>
3 // PR c++/2204: Check for parameters of abstract type in function declarations.
4
5 namespace N1 {
6 struct X;
7
8 struct X { // { dg-message "note" }
9 virtual void xfunc(void) = 0; // { dg-message "note" }
10 };
11
12 struct Y1 {
13 void g(X parm1) {} // { dg-error "abstract" }
14 void g(X parm2[2]) {}
15 void g(X (*parm3)[2]) {}
16 };
17
18 template <int N>
19 struct Y2 {
20 void g(X parm4) {} // { dg-error "abstract" }
21 void g(X parm5[2]) {}
22 void g(X (*parm6)[2]) {}
23 };
24
25 template struct Y2<42>;
26 }
27
28 namespace N2 {
29 struct X1 { // { dg-message "note" }
30 virtual void xfunc(void) = 0; // { dg-message "note" }
31 void g(X1 parm7) {} // { dg-error "abstract" }
32 void g(X1 parm8[2]) {}
33 void g(X1 (*parm9)[2]) {}
34 };
35
36 template <int N>
37 struct X2 { // { dg-message "note" }
38 virtual void xfunc(void) = 0; // { dg-message "note" }
39 void g(X2 parm10) {} // { dg-error "abstract" }
40 void g(X2 parm11[2]) {}
41 void g(X2 (*parm12)[2]) {}
42 };
43
44 template struct X2<42>;
45 }
46
47 namespace N3 {
48 struct X { // { dg-message "note" }
49 virtual void xfunc(void) = 0; // { dg-message "note" }
50 };
51 void g(X parm13) {} // { dg-error "abstract" }
52 void g(X parm14[2]) {}
53 void g(X (*parm15)[2]) {}
54
55 template <int N>
56 void g(X parm16) {} // { dg-error "abstract" }
57 template <int N>
58 void g(X parm17[2]) {}
59 template <int N>
60 void g(X (*parm18)[2]) {}
61
62 template void g<42>(X);
63 }