aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/asan/use-after-scope-4.C
blob: c3b6932609bae141ddc27331cffb7b3a3cd0afc1 (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
/* Caused ICE in in make_decl_rtl, at varasm.c:1311.  */
/* { dg-do compile } */

class A
{
public:
  A () : value (123) {}
  int value;
};

template <typename StoredFunction> class B
{
public:
  template <typename F> B (F p1) : mFunction (p1) { mFunction (); }
  StoredFunction mFunction;
};
template <typename Function>
void
NS_NewRunnableFunction (Function p1)
{
  (B<Function> (p1));
}
class C
{
  void DispatchConnectionCloseEvent (A);
  void AsyncCloseConnectionWithErrorMsg (const A &);
};
void
C::AsyncCloseConnectionWithErrorMsg (const A &)
{
  {
    A message;
    NS_NewRunnableFunction (
      [this, message] { DispatchConnectionCloseEvent (message); });
  }
}