c++/3033: 'using typename' construct doesn't work
sethml@ofb.net
sethml@ofb.net
Fri Jun 1 13:46:00 GMT 2001
>Number: 3033
>Category: c++
>Synopsis: The 'using typename' construct won't compile
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Jun 01 13:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Seth M LaForge
>Release: 3.0 20010526 (Debian prerelease) (Debian testing/unstable)
>Organization:
>Environment:
System: Linux burn 2.2.18 #1 Thu Dec 14 09:22:25 PST 2000 i686 unknown
Architecture: i686
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-x --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
C++ allows the word 'typename' after a 'using' directive. _The C++ Programming Language_ (third edition) [Stroustrup], section A.7 (Grammar/Declarations) defines the using directive:
using-declaration:
"using" "typename"(opt) "::"(opt) nested-name-specifier
unqualified-id ";"
>How-To-Repeat:
Attempt to compile the following:
struct C {
typedef int INT;
};
struct D : public C {
using typename C::INT;
};
int main() {
D::INT x = 666;
}
The compiler complains:
test.cc:6: parse error before `typename'
>Fix:
I'm not sure if there are cases in which the 'typename' portion is required. I've seen it in production code (the loki library, from _Modern C++ Design_ [Alexandrescu].
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list