Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22235

Address of templated inline constexpr variable is not treated as constant expression by gcc?

$
0
0
template <typename T>
inline constexpr int a = 1;

static_assert(&a<void>, "");

This does not compile on gcc 9.2, but compiles on both clang and msvc.

Gcc complains that the expression used for static_assert is not constant expression.

The code compiles after removing template, removing inline, or removing address-of operator.

Is this a gcc bug?


Viewing all articles
Browse latest Browse all 22235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>