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
This commit is contained in:
Jakub Jelinek 2019-02-25 16:01:01 +01:00 committed by Jakub Jelinek
parent b8f412849b
commit ea229aa8a1
2 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2019-02-25 Jakub Jelinek <jakub@redhat.com>
PR c++/89285
* g++.dg/cpp1y/constexpr-89285-2.C: New test.
2019-02-25 Dominique d'Humieres <dominiq@gcc.gnu.org>
PR libfortran/89274

View File

@ -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<int *>((reinterpret_cast<char *>(c) + *c));
*c = reinterpret_cast<char *>(this) - reinterpret_cast<char *>(c);
}
};
struct C : A {
B bar {this};
};
C foo {};