static_assert : expression is not an integral constant expression

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

static_assert : expression is not an integral constant expression

Vassil Vassilev via cfe-dev
Hi Everyone, 

For the below sample,


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

Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: static_assert : expression is not an integral constant expression

Vassil Vassilev via cfe-dev

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

 

 

From: cfe-dev <[hidden email]> On Behalf Of Umesh Kalappa via cfe-dev
Sent: Monday, June 1, 2020 7:27 AM
To: [hidden email] Developers <[hidden email]>
Subject: [cfe-dev] static_assert : expression is not an integral constant expression

 

Hi Everyone, 

 

For the below sample,

 

 

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

 

Virus-free. www.avast.com

 


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: static_assert : expression is not an integral constant expression

Vassil Vassilev via cfe-dev

On 1 Jun 2020, at 10:37, Keane, Erich via cfe-dev wrote:

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.

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


From: cfe-dev <[hidden email]> On Behalf Of Umesh Kalappa via cfe-dev
Sent: Monday, June 1, 2020 7:27 AM
To: [hidden email] Developers <[hidden email]>
Subject: [cfe-dev] 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

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev