[clang] [clang] Fix the local parameter of void type inside the `Requires` expression. (PR #109831)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 24 17:16:59 PDT 2024
================
@@ -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();
+ }
+ }
----------------
c8ef wrote:
Are you suggesting unifying the parameter type check for void type only or for all parameters? As I understand it, the complete parameter check involves a lot more branches, such as support for objc, opencl, etc. It appears challenging to merge these two aspects seamlessly.
https://github.com/llvm/llvm-project/pull/109831
More information about the cfe-commits
mailing list