Debian Codegraph @

gcc/testsuite/g++.dg/debug/debug1.C

raw
1 // Test whether dwarf2 debug info works with named return value optimization
2 // { dg-do compile }
3
4 struct S
5 {
6 virtual ~S();
7 S (const char *str);
8 S& operator= (const char *str);
9 operator const char *() const;
10 S& operator+= (const char *str);
11 };
12 inline S operator+ (const char *s1, const S &s2)
13 {
14 S x (s1);
15 x += s2;
16 return x;
17 }
18 struct U
19 {
20 U ();
21 U& operator= (const char *);
22 const char *foo() const;
23 operator const char *() const { return foo(); }
24 };
25 template <class T> struct V
26 {
27 T v;
28 };
29 template <class T> struct W
30 {
31 V<T> *w;
32 W() : w (0) {}
33 const T& operator* () const { return w->v; }
34 T& operator* () { return w->v; }
35 };
36 struct X {
37 X();
38 };
39 struct Y {
40 Y (const U &u);
41 };
42 X::X()
43 {
44 W<U> a;
45 U b;
46 b = (*a) + "xx";
47 Y c (b);
48 }