[PATCH] D156509: [clang][Interp] Diagnose unknown parameter values

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 09:22:26 PDT 2023


tbaeder marked an inline comment as done.
tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/Interp.cpp:550-554
+  if (isa<ParmVarDecl>(D)) {
+    S.FFDiag(E, diag::note_constexpr_function_param_value_unknown) << D;
+    S.Note(D->getLocation(), diag::note_declared_at) << D->getSourceRange();
+    return false;
+  }
----------------
aaron.ballman wrote:
> No need for this given all code paths return false.
> 
> However, what should we do for calls to this for something other than a `ParmVarDecl`? Should we issue a generic note so the constant expression fails but we get notified to the missing cases?
I think the `return false;` is basically fine, it will show the usual "is not an integral constant expression" error message, and if there's no other note, we can investigate and improve diagnostics.


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

https://reviews.llvm.org/D156509



More information about the cfe-commits mailing list