[RFC] Should _GLIBCXX_CONSTEXPR, _GLIBCXX14_CONSTEXPR etc. expand to 'inline' ?
Antony Polukhin
antoshkka@gmail.com
Fri Sep 27 12:32:00 GMT 2019
On Fri, Sep 27, 2019, 15:02 Jonathan Wakely <jwakely@redhat.com> wrote:
> Currently we have lots of code that has:
>
> inline _GLIBCXX14_CONSTEXPR void
> foo()
>
> When the macro expands to 'constexpr' the 'inline' is redundant,
> because constexpr implies inline.
>
> For older standards we could make it expand to 'inline' instead of
> 'constexpr' and then we don't need the sometimes-redundant 'inline'
> there.
>
I'm in favour of this change.
This would be a change if we have some functions that are *not*
> declared 'inline' for older standards, but become inline when they're
> constexpr functions. I'm not aware of any cases like that.
>
It may also add inline to template functions that do not have explicit
inline on them otherwise. Does the GCCs optimizer uses an explicit inline
as a hint for function inlining and should we care about such differences?
>
More information about the Libstdc++
mailing list