From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15339 invoked by alias); 16 Apr 2002 17:16:11 -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 15270 invoked by uid 71); 16 Apr 2002 17:16:03 -0000 Resent-Date: 16 Apr 2002 17:16:02 -0000 Resent-Message-ID: <20020416171602.15269.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, cuni@programmazione.it Received:(qmail 8369 invoked by uid 61); 16 Apr 2002 17:09:28 -0000 Message-Id:<20020416170928.8362.qmail@sources.redhat.com> Date: Tue, 16 Apr 2002 10:16:00 -0000 From: cuni@programmazione.it Reply-To: cuni@programmazione.it To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/6327: g++ problems where partial specializing nested templates X-SW-Source: 2002-04/txt/msg00844.txt.bz2 List-Id: >Number: 6327 >Category: c++ >Synopsis: g++ problems where partial specializing nested templates >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Apr 16 10:16:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: g++ >Release: Thread model: single - gcc version 3.0 >Organization: >Environment: Mandrake 8.0 on AMD Athlon 800 >Description: It seems that the compiler doesn't use correctly partial specialization of a nested template, even if it produce correct code when template are not nested. >How-To-Repeat: #include #include // generic template template struct Array_traits { template struct Rebind { typedef U Type; }; }; // partial specialization for arrays template struct Array_traits { template struct Rebind { typedef Array_traits::Rebind::Type Type[N]; }; }; int main() { typedef int array_of_int[10][20][30]; Array_traits::Rebind::Type array_of_float; // it prints out A10_A20_A30_i std::cout << typeid(array_of_int).name() << std::endl; // it should print A10_A20_A30_f, but it prints A10_f std::cout << typeid(array_of_float).name() << std::endl; } >Fix: Here is a work-around that doesn't use nested templates: // generic template template struct Array_rebind { typedef U Type; }; // partial specialization template struct Array_rebind { typedef Array_rebind::Type Type[N]; }; >Release-Note: >Audit-Trail: >Unformatted: