This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
g++ compile-time error with template arguments in 4.0 CVS?
- From: Benjamin Redelings I <bredelin at ucla dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 15 Feb 2005 11:37:46 -0800
- Subject: g++ compile-time error with template arguments in 4.0 CVS?
Hi,
I have a reduced testcase from BOOST that fails with yesterdays CVS
(4.0.0 20050214 (experimental)), but compiles under 3.4. I don't know
if this is a bug in BOOST or in g++:
------------------ begin testcase
template< typename T, T N >
struct integral_c
{
static const T value = N;
typedef integral_c< T, static_cast<T>((value + 1)) > next;
// typedef integral_c< T, static_cast<T>((value - 1)) > prior;
// operator T() const { return static_cast<T>(this->value); }
};
------------------- end testcase
% g++-cvs testcase.C
c.C:6: error: template argument 2 is invalid
Note that simply replacing 'value' by 'N' make this compile.
The original error was obtained by including
<boost/numeric/ublas/matrix.hpp>
The following error was recieved:
In file included from /usr/include/boost/config.hpp:35,
from /usr/include/boost/numeric/ublas/config.hpp:24,
from /usr/include/boost/numeric/ublas/matrix.hpp:20,
from a.C:1:
/usr/include/boost/config/compiler/gcc.hpp:92:7: warning: #warning
"Unknown compiler version - please run the configure tests and report
the results"
/usr/include/boost/mpl/aux_/integral_wrapper.hpp:72: error: template
argument 2 is invalid
/usr/include/boost/mpl/aux_/integral_wrapper.hpp:73: error: template
argument 2 is invalid
Please let me know if I should file a PR
thanks!
-BenRI