This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65195] New: [5.0][C++14]Variable template cannot be used as a function
- From: "lucdanton at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Feb 2015 18:08:47 +0000
- Subject: [Bug c++/65195] New: [5.0][C++14]Variable template cannot be used as a function
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65195
Bug ID: 65195
Summary: [5.0][C++14]Variable template cannot be used as a
function
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lucdanton at free dot fr
Created attachment 34858
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34858&action=edit
Minimal testcase
$ g++-trunk --version
g++-trunk (GCC) 5.0.0 20150223 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cat main.cpp
template<typename T>
T constant {};
template<typename T>
struct foo {
int operator()() const
{ return 3; }
};
template<typename T>
auto& f = constant<foo<T>>;
int main()
{
// fine
auto& ref = f<int>; ref();
// error: f<int> cannot be used as a function
f<int>();
}
$ g++-trunk -std=c++14 main.cpp
main.cpp: In function 'int main()':
main.cpp:19:12: error: 'f<int>' cannot be used as a function
f<int>();