repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp1y
/
constexpr-empty2.C
blob
2acfa98364b495de85adb0374fdaaf14213acd53
1
// { dg-do compile { target c++14 } }
2
3
struct A
4
{
5
constexpr A(int) { }
6
};
7
8
struct B: A {
9
constexpr B(int i): A(i) { }
10
constexpr B(const B& b): A(b) { }
11
};
12
13
struct C {
14
B b;
15
constexpr C(int i): b(i) { }
16
constexpr C(const C&c): b(c.b) {}
17
};
18
19
constexpr int f()
20
{
21
C b1{42};
22
C b2{b1};
23
b2.b;
24
return 42;
25
}
26
27
constexpr int i = f();