[PATCH] D117435: [clang] Warning for inline constexpr functions
Evgeny Shulgin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 16 10:30:41 PST 2022
Izaron added a comment.
I will provide more context in this comment.
**Why this patch?**
Clang currently has a warning for duplicating specifiers (`inline inline`, `extern extern`, `consteval consteval`, etc.), but has no warnings for redundant weaker specifiers.
I suggest to add such a group of warnings, starting from `inline constexpr`/`inline consteval` functions.
The Standard says (dcl.constexpr <http://eel.is/c++draft/dcl.constexpr#1.sentence-3>) that `constexpr`/`consteval` functions are implicitly `inline`. But Clang doesn't tell programmers that.
The volume of affected code can be seen in GitHub Search: inline constexpr <https://github.com/search?q=inline+constexpr&type=Code>, inline consteval <https://github.com/search?q=inline+consteval&type=Code>.
**What about the other meaning of `inline`?**
Some years ago, the `inline` keyword meant not only "there may be multiple definitions", but also "there will be `inlinehint` attribute added in LLVM IR".
Fortunately, this is no more since Clang 3.3 release.
`constexpr` and `inline constexpr` functions emit the same LLVM IR attributes. (`consteval` function aren't even emitted to LLVM IR, executing exclusively at compile-time)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117435/new/
https://reviews.llvm.org/D117435
More information about the cfe-commits
mailing list