[PATCH] Add DiagnosticSuppressionScope RAII class

Richard Smith richard at metafoo.co.uk
Wed Nov 12 17:43:02 PST 2014


On Fri, Oct 31, 2014 at 6:26 AM, Brad King <brad.king at kitware.com> wrote:

> On 10/30/2014 09:06 PM, Richard Smith wrote:
> >> One can see that both B::B() and C::C() get errors as desired.
> >
> > That is not guaranteed, and will no longer be the case when we
> > fix the bug described above.
>
> Interesting.  Please help me understand this: the docs of setInvalidDecl
> say it is for "graceful error recovery".  From the point of view of a
> compiler that sounds like once one error has been emitted the failed
> declaration is marked as invalid and any further error resulting from
> encountering the invalid declaration should not be emitted.  That way
> users do not see errors that are only caused by earlier errors.  Is that
> the goal?


Yes, that's the goal and the intent.


> In that case the current behavior does appear to be a bug.


I think so. There seem to be a few bugs here: we shouldn't mark an
instantiated function as invalid because instantiating the body failed
(there's nothing wrong with the declaration); we should use a different
mechanism to track that we shouldn't try to instantiate it again. And we
shouldn't give overload resolution errors if our candidate set contained an
invalid declaration.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141112/13d3ec87/attachment.html>


More information about the cfe-commits mailing list