From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6020 invoked by alias); 3 Oct 2003 00:51:22 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 6007 invoked from network); 3 Oct 2003 00:51:21 -0000 Received: from unknown (HELO hawaii.kealia.com) (209.3.10.89) by sources.redhat.com with SMTP; 3 Oct 2003 00:51:21 -0000 Received: by hawaii.kealia.com (Postfix, from userid 2049) id 6A7E1CB25; Thu, 2 Oct 2003 17:51:21 -0700 (PDT) To: Dan Kegel Cc: gcc@gcc.gnu.org Subject: Re: gcc-3.4 requires 'typename' to use map in a template? References: <3F7CB8E6.5070502@ixiacom.com> <3F7CC2F4.6000007@ixiacom.com> From: David Carlton Date: Fri, 03 Oct 2003 00:51:00 -0000 In-Reply-To: <3F7CC2F4.6000007@ixiacom.com> (Dan Kegel's message of "Thu, 02 Oct 2003 17:29:40 -0700") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-10/txt/msg00086.txt.bz2 On Thu, 02 Oct 2003 17:29:40 -0700, Dan Kegel said: > Dan Kegel wrote: >> #include >> template >> class myclass { >> typedef std::map mymap; >> public: >> void mymethod() { >> typename mymap::iterator myvar; >> myvar = 0; >> } >> }; >> So is gcc-3.4-20031001 right to require typename here, or is this a >> bug? > The local language lawyer says yep, gcc-3.4 could be right; > since mymap depends on T, it needs the 'typename'. > But shoot, you'd *think* a typedef would be enough of a clue! My understanding is that it's not that it needs help figuring out that mymap is a type, it needs help figuring out that mymap::iterator is a type. (Which it might or might not be for different values of T, if you inserted some particularly perverse specializations of std::map.) David Carlton carlton@kealia.com