This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36843] New: Not able to declare a function using function type template parameter
- From: "schaub-johannes at web dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2008 20:41:16 -0000
- Subject: [Bug c++/36843] New: Not able to declare a function using function type template parameter
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When you pass a function-type to a template as a type-parameter, you cannot use
that type to declare member functions (in class templates), or to declare free
functions (in function templates). This looks strange to me. comeau allows to
do this.
Testcase with class template:
template<typename T> struct bar { T foo; };
int main() { Bar<void()> k; }
output:
report.cpp: In instantiation of 'Bar<void ()()>':
report.cpp:1: instantiated from here
report.cpp:1: error: field 'Bar<void ()()>::p' invalidly declared function type
Testcase with function template:
template<typename T> void foo() { T bar; }
int main() { foo<void()>(); }
report.cpp: In function »void foo() [with T = void ()()]«:
report.cpp:1: instantiated from here
report.cpp:1: Fehler: Variable »bar« hat Funktionstyp
--
Summary: Not able to declare a function using function type
template parameter
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schaub-johannes at web dot de
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36843