This is the mail archive of the gcc-patches@gcc.gnu.org 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: [C++ PATCH] Fix 11614


On Tue, 22 Jul 2003 18:49:58 +0100, Nathan Sidwell <nathan@codesourcery.com> wrote:

> Jason Merrill wrote:
>> I think it's simpler to defer handling this until we've parsed the whole
>> declarator.  Here's a patch I haven't gotten around to testing yet:
>
>>         }
>>       else if (decl_context == FIELD)
>>         {
>> + 	/* The C99 flexible array extension.  */
>> + 	if (!staticp && TREE_CODE (type) == ARRAY_TYPE
>> + 	    && TYPE_DOMAIN (type) == NULL_TREE)
>> + 	  {
>> + 	    tree itype = compute_array_index_type (dname, integer_zero_node);
>> + 	    type = build_cplus_array_type (TREE_TYPE (type), itype);
>> + 	  }
>> +   	if (type == error_mark_node)
>>   	  {
>>   	    /* Happens when declaring arrays of sizes which
> What about
> 	typedef int ary_t[];
> 	struct { ary_t s; };
> ? I think you'll be allowing that.

Yep.  From C99:

       As a special case, the last  element  of  a  structure
       with more than one named member may have an incomplete array
       type.  This is called a flexible array member...

It doesn't say anything about syntax.

Jason


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