This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c99 VLA semantics

Mike Stump wrote:
> On Jun 16, 2006, at 3:31 PM, Mark Mitchell wrote:
>> However, cp/pt.c:check_instantiated_args wants the current definition;
>> we don't want to try to instantiate a template with an argument of "void
>> (*)(int (*)][foo()]".  I think Mike's patch would have to include an
>> audit of all existing uses of the predicate, many of which are
>> presumably checking that "there are no VLAs anywhere in here".
> I tried to find a testcase that would show a difference in behavior for
> C++ and could not find any.  Existing checking code ensures all types of
> nastiness that I wanted to sneak into the compiler were caught, the
> remaining that I could get in, failed later on with the same net
> result.  Can you come up with a more complete sketch for a test case?

This code:

template <typename T>
struct S {};

void f(int i) {
  S<void (*)(int (*)[i])> s;

should cause an error in C++.  In C++, it looks like we already disallow
variably modified types in parameters, so your change does not break
this.  However, if we every do implement C99 VLA arguments in C++, then
this would break, so you should add this as a test case.

What regression is your patch fixing?

Mark Mitchell
(650) 331-3385 x713

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]