================
@@ -9509,6 +9509,19 @@ Sema::ActOnStartRequiresExpr(SourceLocation
RequiresKWLoc,
PushDeclContext(BodyScope, Body);
for (ParmVarDecl *Param : LocalParameters) {
+ if (Param->getType()->isVoidType()) {
+ if (LocalParameters.size() > 1) {
+ Diag(Param->getBeginLoc(), diag::err_void_only_param);
+ Body->setInvalidDecl();
+ } else if (Param->getIdentifier()) {
+ Diag(Param->getBeginLoc(), diag::err_param_with_void_type);
+ Body->setInvalidDecl();
+ } else if (Param->getType().hasQualifiers()) {
+ Diag(Param->getBeginLoc(), diag::err_void_param_qualified);
+ Body->setInvalidDecl();
+ }
+ }
----------------
zyn0217 wrote:
I think the invalidity of the Decl should be used to indicate the "unsatisfied"
flag such that the constant expression would result in a false value. That
said, marking the parameters as invalid should also work.
Note that we don't seem ever to use the invalid flag. I think you need to
examine that flag in `RequiresExpr`'s constructor.
https://github.com/llvm/llvm-project/pull/109831
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits