From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3145 invoked by alias); 24 May 2002 10:36:12 -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 3089 invoked by uid 71); 24 May 2002 10:36:06 -0000 Date: Fri, 24 May 2002 03:36:00 -0000 Message-ID: <20020524103606.3085.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: James Kanze Subject: Re: c++/6785: Core dump from g++ 3.0.4 (on Linux) Reply-To: James Kanze X-SW-Source: 2002-05/txt/msg00764.txt.bz2 List-Id: The following reply was made to PR c++/6785; it has been noted by GNATS. From: James Kanze To: gcc-gnats@gcc.gnu.org Cc: nobody@gcc.gnu.org Subject: Re: c++/6785: Core dump from g++ 3.0.4 (on Linux) Date: 24 May 2002 12:31:47 +0200 gcc-gnats@gcc.gnu.org writes: |> It has the internal identification `c++/6785'. I've got a much, much smaller example which triggers the error: --------------------------------------------------- #include template< typename T, size_t N > size_t size( T (&a)[ N ] ) { return N ; } void f() { static char const s[] = "abc" ; int buf[ size( s ) ] ; size_t r = size( buf ) ; } --------------------------------------------------- I was unintentionally using a g++ extension, but the problem occurs when I try and instantiate a template similar to the above on an array with non-constant bounds. This should IMHO be an error -- the standard requires that the instantiation value for a template be a compile time constant, and with variable length arrays, the length of the array is NOT. The easiest fix would be to just turn off support for variable length arrays in g++. I don't think that that is acceptable, however, as it would break existing code. -- James Kanze mailto:kanze@gabi-soft.de Conseils en informatique orientée objet/ Beratung in objektorientierter Datenverarbeitung Ziegelhüttenweg 17a, 60598 Frankfurt, Germany Tel. +49(0)179 2607481