[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#288555: g++-3.3: typeof operator is misparsed in a template function



Package: g++-3.3
Version: 1:3.3.5-5
Severity: normal

Hi,

the following program fails to compile with g++-3.3 like so:

$ g++-3.3 -c -o a.o a.cpp
a.cpp: In function `void C()':
a.cpp:10: error: `__typeof (A)' is not a valid type for a template
constant parameter
a.cpp:10: error: ISO C++ forbids declaration of `b' with no type


const int A = 1;

template< typename T, T t > class B {};

template< typename T >
void C()
{
    // This is not ok here.
    B< __typeof__( A ), A >     b;
}

int main()
{
    // But fine here and most other places.
    B< __typeof__( A ), A >     b;

    return 0;
}


 From what I understand of that error, it appears to be quite
muddled up about things at that point. g++-3.4 seems to compile
this without warning though, so I guess it is time for me to put
all the rest of my code through its wringer too...   :-)

cheers,
Ron


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.10
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages g++-3.3 depends on:
ii  gcc-3.3                     1:3.3.5-5    The GNU C compiler
ii  gcc-3.3-base                1:3.3.5-5    The GNU Compiler Collection (base 
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libstdc++5-3.3-dev          1:3.3.5-5    The GNU Standard C++ Library v3 (d

-- no debconf information



Reply to: