This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Variable-sized types vs. templates
- From: Jason Merrill <jason at redhat dot com>
- To: nathan at cs dot bris dot ac dot uk
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc at gcc dot gnu dot org,nathan at codesourcery dot com, gdr at codesourcery dot com
- Date: Tue, 08 Oct 2002 13:26:02 +0100
- Subject: Re: Variable-sized types vs. templates
- References: <1300000.1033752147@localhost> <3DA2A0F6.795BD4F9@acm.org>
The restrictions on use of VLAs in C99 seem appropriate here: a pointer to
VLA (and more complex versions of same) is called a variably modified (VM)
type. Only a parameter or local variable can have VM type. A VLA cannot
have static storage duration.
Similarly, I think it's appropriate to say that neither VLA nor VM types
are valid template type arguments. I'd also say that a VLA is not a valid
type for a struct member; I don't understand why C99 seems to allow that.
Perhaps it wants to allow it so that uses in different functions can have
different sizes, but that seems incompatible with the stronger C++ model of
struct types.
Jason