[Bug c++/44906] New: g++ is giving error: parse error in template argument list while using a c++ code.
addVecVals<&vec2>(); break; case 2: //sets addStVals<&st1>(); break; case 3: addStVals<&st2>(); break; default: break; } } void print(int vecNum) { switch(vecNum) { case 0: //vecs. printVecVals<&vec1>(); break; case 1: printVecVals<&vec2>(); break; case 2: //sets printStVals<&st1>(); break; case 3: printStVals<&st2>(); break; default: break; } } }; int main(void) { MISC m; m.add(0); m.add(1); m.add(2); m.add(3); return 0; } -- Summary: g++ is giving error: parse error in template argument list while using a c++ code. Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: raychaudhuri_amitava at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44906
[Bug c++/44906] g++ is giving error: parse error in template argument list while using a c++ code.
--- Comment #1 from raychaudhuri_amitava at yahoo dot com 2010-07-10 15:44 --- Created an attachment (id=21176) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21176&action=view) Code which is failing. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44906
[Bug c++/44906] g++ is giving error: parse error in template argument list while using a c++ code.
--- Comment #2 from raychaudhuri_amitava at yahoo dot com 2010-07-10 15:44 --- Created an attachment (id=21177) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21177&action=view) .s file generated by -save-temps -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44906
[Bug c++/44906] g++ is giving error: parse error in template argument list while using a c++ code.
--- Comment #3 from raychaudhuri_amitava at yahoo dot com 2010-07-10 15:45 --- Created an attachment (id=21178) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21178&action=view) .ii file generated by -save-temps -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44906
[Bug c++/44906] g++ is giving error: parse error in template argument list while using a c++ code.
--- Comment #5 from raychaudhuri_amitava at yahoo dot com 2010-07-10 18:45 --- (In reply to comment #4) > The error message is not clear. The issue is that you are not using a > constant > expression for a template arugment. Template arguments are either constant > expressions or types. > Whenever I will be using this kind of template in a class, the variable name is predefined. Now when I create an object and call the function, it will get the address offset and thus should be able to create an instance of that function with same prototype but different body, else for such cases we have to create different functions for each member. Can it be a new feature in g++ compiler? This will make function and objects as first class citizen in C++. We can create function at runtime with different object embedded in it. (I know it can be done by #define, but this is a better way I think.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44906