Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / other / abstract2.C
blob0a8009e9bb3964519b4e8ae5df811dfe88bb39b2
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.
5 namespace N1 {
6   struct X;
8   struct X {  // { dg-message "note" }
9     virtual void xfunc(void) = 0;  // { dg-message "note" }
10   };
12   struct Y1 {
13     void g(X parm1) {}         // { dg-error "abstract" }
14     void g(X parm2[2]) {}
15     void g(X (*parm3)[2]) {}
16   };
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   };
25   template struct Y2<42>;
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   };
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   };
44   template struct X2<42>;
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]) {}
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]) {}
62   template void g<42>(X);