This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36429] structure/array member reference/pointer as template argument
- From: "firda at seznam dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2008 07:50:21 -0000
- Subject: [Bug c++/36429] structure/array member reference/pointer as template argument
- References: <bug-36429-16276@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from firda at seznam dot cz 2008-06-04 07:50 -------
To make things even worse... (allright, I will try ARMGNU 4.1.1 or give up, and
use copy-paste)
typedef unsigned uint;
//##################################################################################################
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; }
void fire(TIME timeout) {
from = NOW - timeout; }};
//##################################################################################################
typedef TTimer <uint, now.centi> Timer;
typedef TTimer <uint, now.synced> CsTimer;
typedef TTimer <uint, now.seconds> SecTimer;
//##################################################################################################
int main() {
Timer timer;
timer.start();
while (!timer.reached(100))
now.centi++;
return 0; }
c:\devel\work>arm-uclibc-gcc -v
Reading specs from
/cygdrive/c/cygwin/arm-tools/bin/../lib/gcc-lib/arm-thumb-elf
/3.3.1/specs
Configured with: /home/Unknown/toolchain/build/gcc-3.3.1/configure
--target=arm-
thumb-elf --host=i686-pc-cygwin --build=i686-pc-cygwin --prefix=/arm-tools
--exe
c-prefix=/arm-tools --bindir=/arm-tools/bin --sbindir=/arm-tools/sbin
--sysconfd
ir=/arm-tools/etc --datadir=/arm-tools/share --localstatedir=/arm-tools/var
--ma
ndir=/arm-tools/man --infodir=/arm-tools/info --libdir=/arm-tools/lib
--included
ir=/arm-tools/include --with-local-prefix=/arm-tools/usr/local
--with-gxx-includ
e-dir=/arm-tools/include/c++ --enable-target-optspace --disable-nls
--with-gnu-a
s --with-gnu-ld --disable-__cxa_atexit --enable-languages=c,c++ --enable-shared
--program-prefix=arm-uclibc-
Thread model: single
gcc version 3.3.1
c:\devel\work>arm-uclibc-gcc -c -mcpu=arm7tdmi -mthumb -gdwarf-2 -MD -Wa
ll -Os -mapcs-frame -mthumb-interwork main.cpp
main.cpp: In member function `void TTimer<TIME, NOW>::start() [with TIME =
uint, const volatile TIME&NOW = Now::centi]':
main.cpp:29: instantiated from here
main.cpp:15: internal compiler error: in build_modify_expr, at cp/typeck.c:5358
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36429