c++/71

rodrigc@gcc.gnu.org rodrigc@gcc.gnu.org
Mon May 28 19:56:00 GMT 2001


The following reply was made to PR c++/71; it has been noted by GNATS.

From: rodrigc@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, jmaurer@menuett.rhein-main.de, rodrigc@gcc.gnu.org,
  martin@loewis.home.cs.tu-berlin.de, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/71
Date: 29 May 2001 02:47:33 -0000

 Synopsis: C++ typedef redefinitions and templates
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: rodrigc
 State-Changed-When: Mon May 28 19:47:32 2001
 State-Changed-Why:
     The C++ Standard, section 7.1.3, paragraph 2 states
     that:
     "In a given scope, a typedef specifier can be used
     to redefine the name of any type
     declared in that scope to refer
     to the type to which it already refers:
     
     typedef int I;
     typedef int I;
     
     In your example
     
        template<class T>
        struct A {
     	 typedef int X;
     	 typedef T X;
        };
     
     Although T may expand to an int when the template is 
     instantiated, in the scope of the template itself, the
     two typedefs are assigning different types to X.
     
     The same error message is generated when compiling with
     gcc 3.0
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=71&database=gcc



More information about the Gcc-prs mailing list