I was playing around with auto template parameters and I was surprised that this code didn\'t compiled:
constexpr auto bar = 2;
template
Are all constexpr variable implicitly inline?
No. Only constexpr functions and constexpr static data members are implicitly inline ([dcl.constexpr]/1).
Also, how does that affect the linkage of my variable bar?
A constexpr variable is const
([dcl.constexpr]/9). A non-inline const
variable that is not explicitly declared extern
has internal linkage ([basic.link]/3).