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


Giovanni Bajo wrote:

Exactly. If you look in the testcase of my patch, it checks for some slightly
different situations which require delayed evaluation of abstract types. The
testcase was carefully constructed thinking of different situations.

Presumably, we would already diagnose it if someone tried to call or
define "f"?


Yes, we do that at the definition point. Calling f() is impossible: if use *s
with a S*, we get an error because we cannot allocate the temporary.

Yes, that's what I meant.


Curiously, EDG diagnoses the example I gave, but not:

struct S;

extern S s;

struct S { virtual void g() = 0; };

Anyhow, why not just keep a list of all VAR_DECLs and FUNCTION_DECLs that have a parameter of an incomplete type, attached to that incomplete type? Then, when a type is completed, if it is abstract, run down the list issuing error messages. After the type is complete, clear the list. To save space, use a hash table mapping class types to these lists, rather than using space in every class type.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com


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