aaron.ballman 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;
+  }
----------------
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?


================
Comment at: clang/test/AST/Interp/functions.cpp:305-312
+  void param(bool b) { // ref-note {{declared here}} \
+                       // expected-note {{declared here}}
+    static_assert(b); // ref-error {{not an integral constant expression}} \
+                      // ref-note {{function parameter 'b' with unknown 
value}} \
+                      // expected-error {{not an integral constant 
expression}} \
+                      // expected-note {{function parameter 'b' with unknown 
value}}
+    static_assert(true ? true : b);
----------------
I'd like another test along the lines of:
```
consteval void param(bool b) {
  static_assert(b); // Same error despite this being a consteval function where 
`b`'s value is always going to be known at compile time
}
```


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

https://reviews.llvm.org/D156509

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to