[clang] [Clang] Qualified functions can't decay into pointers (PR #90353)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 01:50:00 PDT 2024


================
@@ -15071,6 +15071,13 @@ ParmVarDecl *Sema::CheckParameter(DeclContext *DC, SourceLocation StartLoc,
     T = Context.getLifetimeQualifiedType(T, lifetime);
   }
 
+  if (T->isFunctionType() && !T.isReferenceable()) {
+    Diag(NameLoc, diag::err_compound_qualified_function_type)
+        << 1 << true << T
+        << T->castAs<FunctionProtoType>()->getFunctionQualifiersAsString();
+    return nullptr;
+  }
+
----------------
cor3ntin wrote:

We have similar logic thorough this PR, having a function like `DiagnoseUnreferenceableFunctionTypes would be nice`

https://github.com/llvm/llvm-project/pull/90353


More information about the cfe-commits mailing list