Debian Codegraph @

gcc/testsuite/g++.dg/pr98499.C

raw
1 /* PR tree-optimization/98499. */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
4
5 struct string {
6 // pointer to local store
7 char * _M_buf;
8 // local store
9 char _M_local_buf[16];
10
11 __attribute__((noinline)) string() : _M_buf(_M_local_buf) {}
12
13 ~string() {
14 if (_M_buf != _M_local_buf)
15 __builtin_trap();
16 }
17
18 string(const string &__str); // no copies
19 };
20
21 __attribute__((noinline)) static string dir_name() { return string(); }
22 class Importer {
23 string base_path;
24
25 public:
26 __attribute__((noinline)) Importer() : base_path (dir_name()) {}
27 };
28
29 int main() {
30 Importer imp;
31 }