1 // PR c++/94951
2 // { dg-do compile }
3 // { dg-options "-O2 -Wall" }
4 
5 struct A { int a; };
6 template <int N>
7 struct B : public A
8 {
fooB9   static B<N> foo () { B<N> t; t.a = 4; return t; }	// { dg-bogus "dereferencing type-punned pointer will break strict-aliasing rules" }
10 };
11 
12 B<0> b = B<0>::foo ();
13