[PATCH] D112616: Fix crash on invalid code involving late parsed inline methods

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 7 11:35:32 PST 2021


erichkeane added a comment.

In D112616#3177261 <https://reviews.llvm.org/D112616#3177261>, @rjmccall wrote:

> The only alternative to this that I can see would be for the invalid code to produce more valid-seeming AST.
>
> Are deduction guides just not normally allowed for methods?
>
> Also, while I don't think it would eliminate the need to be defensive here, our recovery from misnamed constructors is pretty bad, and it would be great if we recognized that pattern in the parser.

Deduction guides apply to the record themselves... they are this odd 'translation' step to type deduction so they actually don't apply to methods in any way whatsoever.  All they do is provide an additional 'lookup' when trying to construct a class-template. So they are their own special little thing...

They exist on this weird edge of 'being part of the type'... they aren't part of the class at all, but they indicate how to do some level of conversion to get the correct class-template deduction.

As far as producing a more reasonable AST node, I'm not sure what that could be?  I would think we could perhaps have the error case of "no 'return type'" just simply produce NOTHING in the AST, since it has no real value without that part.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112616/new/

https://reviews.llvm.org/D112616



More information about the cfe-commits mailing list