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:
parent
b8f412849b
commit
ea229aa8a1
@ -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
|
||||
|
20
gcc/testsuite/g++.dg/cpp1y/constexpr-89285-2.C
Normal file
20
gcc/testsuite/g++.dg/cpp1y/constexpr-89285-2.C
Normal 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 {};
|
Loading…
Reference in New Issue
Block a user