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

You Wrote Mark Mitchell
> Giovanni Bajo wrote:
>> I will have to create a different incomplete_vars list which stores
>> couples of
>> IDENTIFIER_NODE and TREE_TYPE instead of declarations, for the purpose
>> of
>> delayed evaluation of abstractness.
> I'm sure I'm being dense, but can you back up and explain why we need to
> save away information at all?
> Are we trying to detect cases like
>    struct S;
>    void f(S s);
>    struct S {
>      virtual void g() = 0;
>    };
> where "f" has a parameter with an abstract type?
> Does the standard actually require us to diagnose this case?

No, it does not require we diagnose the declaration of f -- and it
can't require that in a resaonably simple way.  I don't believe
we should try to diagnose that.

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

A call to f requires S to be both complete and non-abstract.  The
same goes for the definition of f.  But by the time user calls f,
we either error because f is undeclared, or S is incomplete or we
know S is abstract.  If all those cases, things follow naturally,

The trickier cases are when we have nested classes in templates.

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