[PATCH] D149516: [Sema] `setInvalidDecl` for error deduction declaration

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 05:46:48 PDT 2023


Fznamznon added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:11141-11145
     if (!Chunk.Fun.hasTrailingReturnType()) {
+      IsValid = false;
       Diag(D.getName().getBeginLoc(),
            diag::err_deduction_guide_no_trailing_return_type);
       break;
----------------
rsmith wrote:
> Can we just return immediately here? I don't see a reason to keep going -- this error may well indicate that the developer didn't actually mean to declare a deduction guide in the first place, so the diagnostic on a function body below is likely to not be useful.
NIT: You can also just do `return Diag(...)` here and in other places. This is equal to `return true`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149516



More information about the cfe-commits mailing list