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
Daily bump.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp1y
/
constexpr-copy1.C
blob
ce0c12d729cd01f40a1a992788cf04cce32a7dcf
1
// PR c++/67813
2
// { dg-do compile { target c++14 } }
3
4
struct Ptr {
5
int* p;
6
7
constexpr Ptr(int* p) noexcept : p{p} {}
8
constexpr int& operator*() const {
9
return *p;
10
}
11
};
12
13
constexpr int f(int& i) {
14
//Ptr first{&i}; // Works.
15
Ptr first = &i; // Error
16
return *first;
17
}
18
19
constexpr int g() {
20
int i = 42;
21
return f(i);
22
}
23
24
#define SA(X) static_assert((X), #X)
25
SA(g() == 42);