Debian Codegraph @

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

raw
1 // PR c++/123331
2 // { dg-do compile }
3 // { dg-additional-options "-O2" }
4
5 struct A { virtual void foo () = 0; };
6 struct B { A a[1]; }; // { dg-error "cannot declare field 'B::a' to be of abstract type 'A'" }
7 // { dg-error "cannot allocate an object of abstract type 'A'" "" { target *-*-* } .-1 }
8
9 template <typename T>
10 void
11 bar (T x)
12 {
13 }
14
15 int
16 main ()
17 {
18 B b;
19 bar (b);
20 }