This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/6785: Core dump from g++ 3.0.4 (on Linux)
- From: James Kanze <kanze at gabi-soft dot de>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 24 May 2002 10:36:06 -0000
- Subject: Re: c++/6785: Core dump from g++ 3.0.4 (on Linux)
- Reply-to: James Kanze <kanze at gabi-soft dot de>
The following reply was made to PR c++/6785; it has been noted by GNATS.
From: James Kanze <kanze@gabi-soft.de>
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 <cstddef>
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