[PATCH] D64874: [Sema] Improve handling of function pointer conversions

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 11:13:02 PDT 2019


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM, though I'd like to see this generalized to handle noreturn too.



================
Comment at: clang/lib/Sema/SemaTemplate.cpp:6997
+      QualType ResultTy;
+      if (getLangOpts().CPlusPlus17 &&
+          IsFunctionConversion(((Expr *)RefExpr.get())->getType(),
----------------
Can we remove the check for C++17 here? I would expect we want to consider the other kind of function conversion (from noreturn function to potentially-returning function) here too, and that applies in all language modes.

Testcase for that bug:

```
template<int (*)()> struct X {};
int f() __attribute__((noreturn));
X<&f> x;
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64874/new/

https://reviews.llvm.org/D64874





More information about the cfe-commits mailing list