[PATCH] D104892: [clang] Stop providing builtin overload candidate for relational function pointer comparisons
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 25 14:04:55 PDT 2021
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.
A couple of comments on test coverage but otherwise this looks great, thanks! It'll be instructive to see if people ask for the warning to not be on by default...
================
Comment at: clang/test/CXX/expr/expr.const/p2-0x.cpp:517
constexpr void (*pf)() = &f, (*pg)() = &g;
- constexpr bool u13 = pf < pg; // expected-error {{constant expression}} expected-note {{comparison has unspecified value}}
- constexpr bool u14 = pf == pg;
----------------
Can you undo this change now? We should retain some test coverage ensuring that we fail constant evaluation in this case.
================
Comment at: clang/test/FixIt/fixit.cpp:298-303
(void)(&t<int>==p); // expected-error {{use '> ='}}
- (void)(&t<int>>=p); // expected-error {{use '> >'}}
#if __cplusplus < 201103L
- (void)(&t<S<int>>>=p); // expected-error {{use '> >'}}
(Shr)&t<S<int>>>>=p; // expected-error {{use '> >'}}
#endif
----------------
We should retain some test coverage that we produce a proper fixit when splitting `>>=` into `>` `>=`. If you want to move this test away from function pointer comparison, we can test the same thing with variable templates these days.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104892/new/
https://reviews.llvm.org/D104892
More information about the cfe-commits
mailing list