static_assert : expression is not an integral constant expression

Hi Everyone,

For the below sample,

https://godbolt.org/z/zugh_5

Clang popping up with an error , not the GCC or any other compiler out there.

For us, it looks like a frontend issue, that needs a fix.

Thank you
~Umesh

Clang appears to be correct here, parameters in a constexpr function are not themselves constexpr. SO, accessing ‘data’ isn’t legal. I don’t know why the other compilers wouldn’t diagnose this.

I presume you’re getting this from a case where TrivialOutputMessage’s constructor takes a template parameter (and you’ve over-reduced), but you’d want to do something more like this : https://godbolt.org/z/uBSWt5

Clang appears to be correct here, parameters in a constexpr function are not themselves constexpr. SO, accessing ‘data’ isn’t legal. I don’t know why the other compilers wouldn’t diagnose this.

To elaborate on the rationale here, constexpr has never been meant that the function can only be used as a constant expression.

John.