j***@yahoo.com
2008-04-18 23:19:51 UTC
The following code gives an "expected primary-expression before '>'"
error when compiled with gcc, Dev-C++ version 4.9.9.2. There is no
such error with MSVC 2005 or 2008. I would be grateful to know if it a
gcc bug, or alternatively what is wrong with the code.
template< typename G >
struct Test
{
template< typename T > T f() const;
};
template< typename G, typename T >
void g()
{
Test< G > t;
t.f< T >(); // error reported for this line
}
void test()
{
g< float, int >();
}
error when compiled with gcc, Dev-C++ version 4.9.9.2. There is no
such error with MSVC 2005 or 2008. I would be grateful to know if it a
gcc bug, or alternatively what is wrong with the code.
template< typename G >
struct Test
{
template< typename T > T f() const;
};
template< typename G, typename T >
void g()
{
Test< G > t;
t.f< T >(); // error reported for this line
}
void test()
{
g< float, int >();
}
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]