From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27846 invoked by alias); 7 Dec 2002 14:36:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 27826 invoked by uid 71); 7 Dec 2002 14:36:00 -0000 Resent-Date: 7 Dec 2002 14:36:00 -0000 Resent-Message-ID: <20021207143600.27825.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, eivuokko@bonumit.com Received: (qmail 27733 invoked by uid 61); 7 Dec 2002 14:35:00 -0000 Message-Id: <20021207143500.27732.qmail@sources.redhat.com> Date: Sat, 07 Dec 2002 06:36:00 -0000 From: eivuokko@bonumit.com Reply-To: eivuokko@bonumit.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/8858: Gcc "rebinds" template member names. X-SW-Source: 2002-12/txt/msg00436.txt.bz2 List-Id: >Number: 8858 >Category: c++ >Synopsis: Gcc "rebinds" template member names. >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Sat Dec 07 06:36:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: eivuokko@bonumit.com >Release: gcc-3.2 >Organization: >Environment: (also tried with rc version of mingw-gcc 3.2.1) C:\base\test>g++ -v Reading specs from c:/devel/mingw/bin/../lib/gcc-lib/mingw32/3.2/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host= mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable -languages=f77,c++,objc,ada --disable-win32-registry --disable-shared Thread model: win32 gcc version 3.2 (mingw special 20020817-1) >Description: If you have type inside a template, issuing last template-id as member of it rebinds the template instead of using previous type. ie typedef foo::bar::bar baz; generates same effect as typedef foo::bar baz; >How-To-Repeat: example session, program asserts in unexpected place, it should assert before, for difffrent type. C:\base\test>g++ gcc_rebind_bug.cpp -o gcc_rebind_bug -Wall && gcc_rebind_bug Assertion failed: ( IsSame< cons > >, test_ty pe>::Value ), file gcc_rebind_bug.cpp, line 37 >Fix: Haven't found one yet, except moving member template outside the class. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="gcc_rebind_bug.cpp" Content-Disposition: inline; filename="gcc_rebind_bug.cpp" #include template class cons {}; template class list { public: typedef L_ type; template class add : public ::list< ::cons > {}; } ; template class IsSame { public: enum { Value = false } ; } ; template class IsSame { public: enum { Value = true } ; } ; int main() { // assure IsSame works assert(( IsSame::Value )); assert(( IsSame::Value )); assert(( IsSame >,cons > >::Value )); // real test typedef list >::add::add::type test_type; // this should absolutely fail assert(( IsSame< cons >, test_type>::Value )); // and this shouldn't assert(( IsSame< cons > >, test_type>::Value )); }