This patch adds a C++ testcase for the PR Martin J. fixed some time ago. Tested on x86_64-linux, applying to 4.9/5/trunk.
2015-04-30 Marek Polacek <pola...@redhat.com> PR tree-optimization/63551 * g++.dg/ipa/pr63551.C: New test. diff --git gcc/testsuite/g++.dg/ipa/pr63551.C gcc/testsuite/g++.dg/ipa/pr63551.C index e69de29..03e0339 100644 --- gcc/testsuite/g++.dg/ipa/pr63551.C +++ gcc/testsuite/g++.dg/ipa/pr63551.C @@ -0,0 +1,23 @@ +// { dg-options "-O -Wno-psabi" } +// { dg-do compile } + +struct A { int a; }; +template <typename T, typename V> struct B { V operator[] (T); }; +union U { long double ld; void *v; }; +A a; + +void +bar (U &x) +{ + if (x.v) *reinterpret_cast <A *>(x.v) = a; +} + +struct C { C (A) { c.ld = 0; bar (c); } U c; }; +struct D { A d, e; void foo () { f[0][d] = e; } B <int, B <A, C> > f; }; + +void +baz () +{ + D d; + d.foo (); +} Marek