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

'using typename' construct doesn't work



>Submitter-Id:	net-debian
>Originator:	Seth M LaForge
>Organization:	
>Confidential:	no
>Synopsis:	The 'using typename' construct won't compile
>Severity:	serious
>Priority:	medium
>Category:	c++
>Class:		rejects-legal
>Release:	3.0 20010526 (Debian prerelease) (Debian testing/unstable)
>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].



Reply to: