comparison gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const5.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // PR c++/91264
2 // { dg-do compile { target c++14 } }
3
4 struct A {
5 mutable int n;
6 constexpr A() : n(1) { n = 2; }
7 };
8
9 struct B {
10 const A a;
11 constexpr B() {
12 const_cast<A &>(a).n = 3;
13 }
14 };
15
16 constexpr B b{};
17 static_assert((b.a.n, 1), "");