c8ef wrote: After spending the entire afternoon attempting to streamline the parameter check process, I still haven't found an elegant solution to consolidate it into a single location. I explored how GCC approaches this issue and discovered that while GCC does utilize a single parameter check function (specifically in the `grokparm` function in `gcc/c/c-decl.cc`), it doesn't differentiate between the two contexts. As a result, it permits a `requires` clause to include a parameter with a default argument: [godbolt](https://gcc.godbolt.org/z/azcrKKf7T).
Upon examining the actual parameter checking process, it seems that the most crucial check related to require-expressions is for void types. Other checks are mainly for OpenCL, Objective-C, etc. Merging these checks for just a single void check might be overkill. https://github.com/llvm/llvm-project/blob/75e08a527b716a11b3085a9ea4f5bed80c386323/clang/lib/Sema/SemaType.cpp#L5143-L5236 Therefore, I recommend adding the void parameter check directly into `SemaExprCXX` for an immediate fix. If there's a future need to consolidate the checks, we can consider refactoring later. Additionally, there appears to be some overlap between the parameter checks in `Sema::BuildFunctionType` and `GetFullTypeForDeclarator`. It might be worth cleaning up this redundancy. https://github.com/llvm/llvm-project/blob/75e08a527b716a11b3085a9ea4f5bed80c386323/clang/lib/Sema/SemaType.cpp#L2637-L2660 CC @mizvekov @zyn0217 @erichkeane https://github.com/llvm/llvm-project/pull/109831 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits