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: [C++ PATCH] [PR2204] Check for parameters of abstract types -Take 3

Giovanni Bajo wrote:

Jason Merrill wrote:


Alas, this solution is partial, mainly because it doesn't get into
array types. In fact, parameters with array type are decayed into
pointer types within grokdeclarator (even before a PARM_DECL is
built), so they never get registered into the incomplete_vars list.
A solution for this might be extracting the standard decays out of
grokdeclarator, and having grokparms call it. There is also another
user of grokdeclarator(PARM) (in pt.c, to build template
parameters), which should be updated as well. Comments on this plan
are highly appreciated.

There's a much simpler solution: just check for abstract types in

I tried this but it occurred to me that if I checked for abstract types in
grokdeclarator immediatly after the big loop where the type for the declaration
is constructed (and where create_array_type_for_decl is called for the
ARRAY_REF case), I could catch both the array and the non-array case at the
same time, unifying the check. In fact, it works beautifully, so I removed the
other check for abstractness from grokparms. The only quirk is that I need to
create a PARM_DECL just for the purpose of storing it in the incomplete_vars
list (it cannot be done with the real PARM_DECL because that's already decayed
from array to pointer), but it doesn't seem too much of a problem to me.

It is a problem -- DECLs are big, and so creating extra DECLs is a problem.

We should find another way.

Mark Mitchell
CodeSourcery, LLC
(916) 791-8304

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