Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr53011.C

raw
1 // { dg-do compile }
2 // { dg-additional-options "-Wno-return-type" }
3
4 extern "C" class WvFastString;
5 typedef WvFastString& WvStringParm;
6 struct WvFastString {
7 ~WvFastString();
8 operator char* () {}
9 };
10 class WvString : WvFastString {};
11 class WvAddr {};
12 class WvIPAddr : WvAddr {};
13 struct WvIPNet : WvIPAddr {
14 bool is_default() {}
15 };
16 template<class T, bool> struct WvTraits_Helper {
17 static void release(T *obj) {
18 delete obj;
19 }
20 };
21 template<class From> struct WvTraits {
22 static void release(From *obj) {
23 WvTraits_Helper<From, 0>::release(obj);
24 }
25 };
26 struct WvLink {
27 void *data;
28 WvLink *next;
29 bool autofree;
30 WvLink(bool, int) : autofree() {}
31 bool get_autofree() {}
32
33 void unlink() {
34 delete this;
35 }
36 };
37 struct WvListBase {
38 WvLink head, *tail;
39 WvListBase() : head(0, 0) {}
40 };
41 template<class T> struct WvList : WvListBase {
42 ~WvList() {
43 zap();
44 }
45
46 void zap(bool destroy = 1) {
47 while (head.next) unlink_after(&head, destroy);
48 }
49
50 void unlink_after(WvLink *after, bool destroy) {
51 WvLink *next = 0;
52 T *obj = (destroy && next->get_autofree()) ?
53 static_cast<T*>(next->data) : 0;
54
55 if (tail) tail = after;
56 next->unlink();
57 WvTraits<T>::release(obj);
58 }
59 };
60 typedef WvList<WvString>WvStringListBase;
61 class WvStringList : WvStringListBase {};
62 class WvSubProc {
63 WvStringList last_args, env;
64 };
65 void addroute(WvIPNet& dest, WvStringParm table) {
66 if (dest.is_default() || (table != "default")) WvSubProc checkProc;
67 }