[Bug c++/36843] Not able to declare a function using function type template parameter

2008-07-15 Thread schaub-johannes at web dot de


--- Comment #1 from schaub-johannes at web dot de  2008-07-15 20:43 ---
(In reply to comment #0)
 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:
 
 templatetypename T struct bar { T foo; }; 
 int main() { Barvoid() k; }
 
 output: 
 report.cpp: In instantiation of 'Barvoid ()()':
 report.cpp:1:   instantiated from here
 report.cpp:1: error: field 'Barvoid ()()::p' invalidly declared function 
 type
 
 
 Testcase with function template:
 
 templatetypename T void foo() { T bar; }  
 int main() { foovoid()(); }
 
 report.cpp: In function »void foo() [with T = void ()()]«:
 report.cpp:1:   instantiated from here
 report.cpp:1: Fehler: Variable »bar« hat Funktionstyp
 

I'm sorry for the german output message in the second testcase. i forgot to
change language:

report.cpp: In function 'void foo() [with T = void ()()]':
report.cpp:1:   instantiated from here
report.cpp:1: error: variable 'bar' has function type


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36843



[Bug c++/36843] Not able to declare a function using function type template parameter

2008-07-15 Thread schaub-johannes at web dot de


--- Comment #2 from schaub-johannes at web dot de  2008-07-15 22:22 ---
I've written carefully through the Standard, and found this paragraph:

14.3.1p3
If a declaration acquires a function type through a type dependent on a
template-parameter and this causes a declaration that does not use the
syntactic form of a function declarator to have function type, the program is
ill-formed.

So i mark this as invalid. 


-- 

schaub-johannes at web dot de changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36843