================
@@ -7518,6 +7523,154 @@ static Attr *getCCTypeAttr(ASTContext &Ctx, ParsedAttr 
&Attr) {
   llvm_unreachable("unexpected attribute kind!");
 }
 
+std::optional<FunctionEffectMode>
+Sema::ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName) {
+  auto BadExpr = [&]() {
+    Diag(CondExpr->getExprLoc(), diag::err_attribute_argument_type)
+        << ("'" + AttributeName.str() + "'") << AANT_ArgumentIntegerConstant
+        << CondExpr->getSourceRange();
+    return std::nullopt;
+  };
+
+  if (CondExpr->isTypeDependent() || CondExpr->isValueDependent()) {
+    if (CondExpr->containsUnexpandedParameterPack())
+      return BadExpr();
+    return FunctionEffectMode::Dependent;
+  }
----------------
Sirraide wrote:

```suggestion
  if (DiagnoseUnexpandedParameterPack(CondExpr))
      return std::nullopt;
  if (CondExpr->isTypeDependent() || CondExpr->isValueDependent())
    return FunctionEffectMode::Dependent;
```
I don’t think the way this is set up at the moment actually tells the user that 
the problem is an unexpanded pack, whereas this should.

(Also, for the record, this function *could* be split into separate `ActOn` and 
`Build` functions where the former contains only the unexpanded parameter pack 
check and the latter everything else, and only the latter would then be called 
in `TreeTransform`, but this is still simple enough to where that probably 
isn’t necessary and can be left as-is)

https://github.com/llvm/llvm-project/pull/84983
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to