From: Jakub Jelinek Date: Mon, 25 Feb 2019 15:01:01 +0000 (+0100) Subject: re PR c++/89285 (ICE after casting the this pointer in the constructor in C++17 mode) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea229aa8a1bab0770a1fbd65bb577d2dc4925b69;p=gcc.git re PR c++/89285 (ICE after casting the this pointer in the constructor in C++17 mode) PR c++/89285 * g++.dg/cpp1y/constexpr-89285-2.C: New test. From-SVN: r269188 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bbe27aa83a6..70abccc4d1a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-25 Jakub Jelinek + + PR c++/89285 + * g++.dg/cpp1y/constexpr-89285-2.C: New test. + 2019-02-25 Dominique d'Humieres PR libfortran/89274 diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-89285-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-89285-2.C new file mode 100644 index 00000000000..656bc9cb7f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-89285-2.C @@ -0,0 +1,20 @@ +// PR c++/89285 +// { dg-do compile { target c++14 } } + +struct A { + int a {}; +}; +struct B { + int b {}; + constexpr B (A *x) { + int *c = &x->a; + while (*c) + c = reinterpret_cast((reinterpret_cast(c) + *c)); + *c = reinterpret_cast(this) - reinterpret_cast(c); + } +}; +struct C : A { + B bar {this}; +}; + +C foo {};