Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const12.C

raw
1 // PR c++/91264
2 // { dg-do compile { target c++14 } }
3
4 struct A {
5 const int n;
6 int m;
7 constexpr A() : n(1), m(2) { }
8 };
9 struct B {
10 A a;
11 constexpr B() {
12 int *p = &a.m;
13 *p = 3;
14 }
15 };
16 constexpr B b;
17 static_assert(b.a.m == 3, "");