gnu_inline attribute doesn't work on implicitly inline functions
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
It seems that clang++ ignores the `[[gnu::gnu_inline]]` attribute unless it's accompanied by an explicit `inline` keyword, even on functions that are implicitly inline, e.g. ones with `constexpr` or defined in the class body.
The [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-gnu_005finline-function-attribute) do say "In C++, this attribute does not depend on extern in any way, but it still requires the inline keyword to enable its special behavior." but that isn't supposed to mean that you need to add `inline` where it's already implied, like on a `constexpr` function or one declared in the class body.
Contributor guide
Research direction
Start by reproducing the reported behavior with clang++ for [[gnu::gnu_inline]] on constexpr functions and functions defined in a class body, then compare it with the GCC documentation linked in the issue. Done means implicitly inline C++ functions receive the intended gnu_inline behavior without an explicit inline keyword.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100