summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape.C
blob: 9ea619877059f5a329649bae1138a3d67e67f3b8 (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
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing" } */

#include <string>
#include <list>

class A;

class B {
public:
    void foo(A&);
    std::string s;
};

class A {
public:
    A& qaz() {
	l.push_back( new A() );
	return *l.back();
    }
    std::list<A*> l;
};

void bar()
{
  A a;
  B b;
  b.foo(a.qaz());
}