github.com/ice-blockchain/go/src@v0.0.0-20240403114104-1564d284e521/debug/dwarf/testdata/cppunsuptypes.cc (about)

     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  
     8  int i = 3;
     9  double d = 3;
    10  
    11  // anonymous reference type
    12  int &culprit = i;
    13  
    14  // named reference type
    15  typedef double &dref;
    16  dref dr = d;
    17  
    18  // incorporated into another type
    19  typedef struct {
    20    dref q;
    21    int &r;
    22  } hasrefs;
    23  
    24  hasrefs hr = { d, i };
    25  
    26  // This code is intended to trigger a DWARF "pointer to member" type DIE
    27  struct CS { int dm; };
    28  
    29  int foo()
    30  {
    31    int CS::* pdm = &CS::dm;
    32    CS cs = {42};
    33    return cs.*pdm;
    34  }