[cfe-dev] static_assert : expression is not an integral constant expression

John McCall via cfe-dev cfe-dev at lists.llvm.org
Tue Jun 2 10:42:38 PDT 2020


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 <cfe-dev-bounces at lists.llvm.org> On Behalf Of Umesh 
> Kalappa via cfe-dev
> Sent: Monday, June 1, 2020 7:27 AM
> To: cfe-dev at lists.llvm.org Developers <cfe-dev at lists.llvm.org>
> 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
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200602/3b979bca/attachment.html>


More information about the cfe-dev mailing list