From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 617 invoked by alias); 15 Jul 2005 12:47:24 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 604 invoked by uid 22791); 15 Jul 2005 12:47:21 -0000 Received: from s1.mailresponder.info (HELO s1.mailresponder.info) (193.24.237.10) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 15 Jul 2005 12:47:21 +0000 Received: from [192.168.2.52] (82.98.209.5) by s1.mailresponder.info with MERCUR Mailserver (v4.02.30 ODAtMjQzOS03MTc5) for ; Fri, 15 Jul 2005 14:46:57 +0200 Subject: g++ 3.4 more restrictive than g++ 3.3 ? From: Mathieu Fluhr To: gcc-help@gcc.gnu.org Content-Type: text/plain Date: Fri, 15 Jul 2005 12:47:00 -0000 Message-Id: <1121431610.21076.9.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-07/txt/msg00145.txt.bz2 Hello all I'm just wondering about some differences between g++ 3.3 (3.3.6) and g++ 3.4 (3.4.5). Please have a look to this piece of code: ---8<--------------------------------------------- #include template class A { protected: ValueType m_Field; }; template class B : public A { void TestParam(ValueType i) { m_Field = i; } }; int main(void) { return 0; } ---8<--------------------------------------------- As far as I know the C++ language, syntax seems to be correct, and g++ 3.3 does not output any error/warning (even with -Wall option). The problem is that g++ 3.4 (and 4.0 btw) outputs the following: For g++ 3.4: Inherit.cpp: In member function `void B::TestParam(ValueType)': Inherit.cpp:16: error: `m_Field' undeclared (first use this function) Inherit.cpp:16: error: (Each undeclared identifier is reported only once for each function it appears in.) For g++ 4.0: Inherit.cpp: In member function 'void B::TestParam(ValueType)': Inherit.cpp:16: error: 'm_Field' was not declared in this scope The very weird thing is that if I change the line 16 from m_Field = i; to this->m_Field = i; everything works without any kind of problem !!! So is this behaviour normal ? Best Regards, Mathieu Fluhr