Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.other/init9.C

raw
1 // { dg-do assemble }
2 // { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } }
3
4 // Based on a testcase submitted by Tudor Hulubei <[email protected]>
5
6 // X is not a POD because it has a user-defined destructor.
7 // Therefore, we can't cross its initialization.
8
9 // vector<int> is not even an aggregate; nevertheless, no error is
10 // reported...
11
12 struct A {
13 A() {}
14 };
15
16 void a() {
17 goto bar; // { dg-message "" } jump from here
18 A x; // { dg-message "" } jump crosses initialization
19 bar: // { dg-error "" } jump to here
20 ;
21 }
22
23 struct X {
24 ~X() {}
25 };
26
27 void b() {
28 // This was ill-formed until DR 2256.
29 goto bar;
30 X x;
31 bar:
32 ;
33 }
34
35 #include <vector>
36
37 void c() {
38 goto bar; // { dg-message "" } jump from here
39 std::vector<int> x; // { dg-message "" } jump crosses initialization
40 bar: // { dg-error "" } jump to here
41 ;
42 }