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
/
var-templ37.C
blob
11021a3f5bc458e12e890225db6df702521f9af7
1
// PR c++/65195
2
// { dg-do compile { target c++14 } }
3
4
template<typename T>
5
T constant {};
6
7
template<typename T>
8
struct foo {
9
int operator()() const
10
{ return 3; }
11
};
12
13
template<typename T>
14
auto& f = constant<foo<T>>;
15
16
int main()
17
{
18
// fine
19
auto& ref = f<int>; ref();
20
21
// error: f<int> cannot be used as a function
22
f<int>();
23
}