[Bug c++/39458] New: function template in template class cant be called from other template class
mrpugh at gmx dot de
gcc-bugzilla@gcc.gnu.org
Fri Mar 13 15:56:00 GMT 2009
compiling the example code
*******(min_example.cpp)
#include <stdio.h>
template <int i>
class A
{
public:
template <typename T>
void print(int j)
{
printf("i: %i j: %i\n", i, j);
}
};
template <int j>
class B
{
public:
void print(A<j> *a)
{
a->print<int>(j);
}
};
int main()
{
A<23> *a = new A<23>();
B<23> b;
a->print<int>(5);
b.print(a);
return 0;
}
*******
with the command
>g++ min_example.cpp -o min_example
gives the error message
min_exmpl.cpp: In member function 'void B<j>::print(A<j>*)':
min_exmpl.cpp:20: error: expected primary-expression before 'int'
min_exmpl.cpp:20: error: expected `;' before 'int'
--
Summary: function template in template class cant be called from
other template class
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mrpugh at gmx dot de
GCC build triplet: x86_64 GNU/Linux
GCC host triplet: x86_64 GNU/Linux
GCC target triplet: x86_64 GNU/Linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39458
More information about the Gcc-bugs
mailing list