------- Comment #2 from firda at seznam dot cz 2008-06-04 06:31 -------
Can you help me, what is wrong? I'd like to verify it as resolved ;)
g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)
g++ xx.c
xx.c:9: error: template argument 1 is invalid
xx.c:9: error: invalid type in declaration before ; token
xx.c:10: error: s cannot appear in a constant-expression
xx.c:10: error: `.' cannot appear in a constant-expression
xx.c:10: error: template argument 1 is invalid
xx.c:10: error: invalid type in declaration before ; token
xx.c:11: error: template argument 1 is invalid
xx.c:11: error: invalid type in declaration before ; token
xx.c:12: error: s cannot appear in a constant-expression
xx.c:12: error: `.' cannot appear in a constant-expression
xx.c:12: error: template argument 1 is invalid
xx.c:12: error: invalid type in declaration before ; token
xx.c:15: error: template argument 1 is invalid
xx.c:15: error: invalid type in declaration before ; token
xx.c:16: error: x cannot appear in a constant-expression
xx.c:16: error: an array reference cannot appear in a constant-expression
xx.c:16: error: template argument 1 is invalid
xx.c:16: error: invalid type in declaration before ; token
xx.c:17: error: template argument 1 is invalid
xx.c:17: error: invalid type in declaration before ; token
xx.c:18: error: x cannot appear in a constant-expression
xx.c:18: error: an array reference cannot appear in a constant-expression
xx.c:18: error: template argument 1 is invalid
xx.c:18: error: invalid type in declaration before ; token
What I really want to do is this (static inside the struct solves my problem
just fine - also in 3.3.1):
extern struct Now {
/*static*/ volatile uint centi;
/*static*/ uint synced;
/*static*/ uint seconds; }
now;
template<typename TIME, const volatile TIME& NOW>
class TTimer {
public:
TIME from;
public:
void start() {
from = NOW; }
TIME elapsed() {
return NOW - from; }
bool reached(TIME timeout) {
return NOW - from >= timeout; }};
typedef TTimer <uint, now.centi> Timer;
typedef TTimer <uint, now.synced> CsTimer;
typedef TTimer <uint, now.seconds> SecTimer;
(I use my own preprocessor, I do not write the code like that)
--
firda at seznam dot cz changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36429