This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix PR c++/29475: Incomplete template diagnostics
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Simon Martin <simartin at users dot sourceforge dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 12 Nov 2006 11:08:30 -0800
- Subject: Re: [PATCH] Fix PR c++/29475: Incomplete template diagnostics
- References: <firstname.lastname@example.org>
Simon Martin wrote:
> 2006-11-05 Simon Martin <email@example.com>
> PR c++/29475
> * call.c (build_over_call): Always call perform_or_defer_access_check with
> the declaration of the function member being called to have a proper
> diagnostic in case it is not accessible. When the member is a member
> template, the DECL_ACCESS to use is in the primary template; FN is
> temporarily altered accordingly.
I don't like this approach for several reasons. First, temporary
changing the internal representation of things can potentially break
invariants expected by the rest of the code. Second, if the function
came from a PCH file, we're now triggering writes we don't need, and we
know that number of PCH pages written is a good metric for time. Third,
if perform_or_defer_access_check defers the check, it will still come
out wrong: when it goes to process the saved check, the temporary change
will have been undone.
I think that leaves two possible solutions: keep DECL_ACCESS in sync
between functions and specializations, or pass another parameter to
perform_or_defer_access_check, with the declaration to use when printing
And, I prefer the second option, since keeping DECL_ACCESS seems harder.
However, in order to make this work with deferred checks, you would
have to save the deferred check too. Presently, the deferred checks are
stored in a TREE_LIST, and so we've run out of room there. But, we
don't want a TREE_LIST anyhow; these should be a VEC of a custom data
/* The declaration to use when checking access. */
/* The base class in which the declaration is referenced. */
/* The declaration to use when printing diagnostics. */
Would you care to take on that change as well? If not, you could add
the extra parameter to perform_or_defer_access_check, but just store
decl, rather than diagnostic_decl. That will not fix the full problem,
but it will fix some of the cases, and it moves us in the right direction.
(650) 331-3385 x713