c++: constantness of call to function pointer [PR111703]
[official-gcc.git] / gcc / testsuite / g++.dg / pr98499.C
blobace088aeed9e942e761f30396e5cc5f997ccf4ba
1 /* PR tree-optimization/98499.  */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
5 struct string {
6   // pointer to local store
7   char * _M_buf;
8   // local store
9   char _M_local_buf[16];
11   __attribute__((noinline)) string() : _M_buf(_M_local_buf) {}
13   ~string() {
14     if (_M_buf != _M_local_buf)
15       __builtin_trap();
16   }
18   string(const string &__str); // no copies
21 __attribute__((noinline)) static string dir_name() { return string(); }
22 class Importer {
23   string base_path;
25 public:
26   __attribute__((noinline)) Importer() : base_path (dir_name()) {}
29 int main() {
30   Importer imp;