From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13559 invoked by alias); 7 Oct 2006 09:08:38 -0000 Received: (qmail 13551 invoked by uid 22791); 7 Oct 2006 09:08:38 -0000 X-Spam-Check-By: sourceware.org Received: from smtp2.yandex.ru (HELO mx18.yandex.ru) (213.180.200.18) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 07 Oct 2006 09:08:32 +0000 Received: from host-195-162-40-144.pppoe.omsknet.ru ([195.162.40.144]:19718 "EHLO mazay" smtp-auth: "Mazzzy2005" TLS-CIPHER: TLS-PEER-CN1: ) by mail.yandex.ru with ESMTP id S3376213AbWJGJI0 (ORCPT ); Sat, 7 Oct 2006 13:08:26 +0400 X-Comment: RFC 2476 MSA function at smtp2.yandex.ru logged sender identity as: Mazzzy2005 Date: Sat, 07 Oct 2006 09:08:00 -0000 From: Mazay X-Mailer: The Bat! (v3.71.01) Professional Reply-To: Mazzzy2005@yandex.ru Message-ID: <1629767664.20061007160840@yandex.ru> To: gcc-help@gcc.gnu.org Subject: gcc 3.4.5: Partially specialized descendant of template doesn't see members of base MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2006-10/txt/msg00059.txt.bz2 Hello. I'm not sure, if this code should to compile in accordance with ISO, but it compiles by g++ 4.1.1 and by VC2003-2005. Here is a little test for it: --------------------------------------------------------- template class Base { protected: T x; Base() {} }; template class Der: public Base { public: using Base::x; Der():Base() {} int get(); }; template class Der: public Base { public: using Base::x; //!! Der():Base() {} int get(); }; template int Der::get() { return x-num; } template int Der::get() { return x+4; //38 row. The error is here. x is not declared in this scope. } int main() { return 0; } --------------------------------------------------------- Compilation output: --------------------------------------------------------- C:\prg\test\mingw_templ>g++ main.cpp main.cpp: In member function `int Der::get()': main.cpp:38: error: `x' was not declared in this scope --------------------------------------------------------- Compiler version information: --------------------------------------------------------- C:\prg\test\mingw_templ>g++ -v Reading specs from C:/Install/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix= /mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shar ed --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.5 (mingw special) --------------------------------------------------------- An error can be fixed by replacing of string "return x+4;" by "return this->x+4;". But it is fairly bad decision. I suppose that this is a bug (because it compiles by 4.1.1), but I can't use newer compiler, because 3.4.5 is the lattest in MinGW. And I have to use MinGW :( . I hope, that some better workaround or patch for compiler exists, and somebody here can help me. Regards, Mazay.