aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-nested.C
blob: 160694c3c9f2a9d0409ebfe221d51c5a76ebb0b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// { dg-do compile }
// { dg-options "--std=c++11 -dA -gdwarf-4 -fdebug-types-section -fno-merge-debug-strings" }

// Check that -fdebug-types-sections does not copy a full referenced type
// into a type unit.

// Checks that at least one type unit is generated.
//
// { dg-final { scan-assembler "DIE \\(\[^\n\]*\\) DW_TAG_type_unit" } }
//
// Check that func is declared exactly once in the debug info (in the
// compile unit).
//
// { dg-final { scan-assembler-times "\\.ascii \"func\\\\0\"\[^\n\]*DW_AT_name" 1 } }
//
// Check to make sure that no type unit contains a DIE with DW_AT_low_pc
// or DW_AT_ranges.  These patterns assume that the compile unit is always
// emitted after all type units.
//
// { dg-final { scan-assembler-not "\\.quad\[^\n\]*DW_AT_low_pc.*DIE \\(\[^\n\]*\\) DW_TAG_compile_unit" } }
// { dg-final { scan-assembler-not "\\.quad\[^\n\]*DW_AT_ranges.*DIE \\(\[^\n\]*\\) DW_TAG_compile_unit" } }

struct A {
  A();
  virtual ~A();
  virtual void foo();
 private:
  int data;
};

struct B {
  B();
  virtual ~B();
};

extern B* table[];

struct D {
  template <typename T>
  T* get(int i)
  {
    B*& cell = table[i];
    if (cell == 0)
      cell = new T();
    return static_cast<T*>(cell);
  }
};

void func(D* d)
{
  struct C : B {
    A a;
  };
  d->get<C>(0)->a.foo();
}