...

Text file src/debug/dwarf/testdata/cppunsuptypes.cc

Documentation: debug/dwarf/testdata

     1// Copyright 2019 The Go Authors. All rights reserved.
     2// Use of this source code is governed by a BSD-style
     3// license that can be found in the LICENSE file.
     4
     5// cppunsuptypes.elf built with g++ 7.3
     6//    g++ -g -c -o cppunsuptypes.elf cppunsuptypes.cc
     7
     8int i = 3;
     9double d = 3;
    10
    11// anonymous reference type
    12int &culprit = i;
    13
    14// named reference type
    15typedef double &dref;
    16dref dr = d;
    17
    18// incorporated into another type
    19typedef struct {
    20  dref q;
    21  int &r;
    22} hasrefs;
    23
    24hasrefs hr = { d, i };
    25
    26// This code is intended to trigger a DWARF "pointer to member" type DIE
    27struct CS { int dm; };
    28
    29int foo()
    30{
    31  int CS::* pdm = &CS::dm;
    32  CS cs = {42};
    33  return cs.*pdm;
    34}

View as plain text