[cfe-dev] Allow constexpr in vector extensions
Tom Westerhout via cfe-dev
cfe-dev at lists.llvm.org
Tue Aug 29 13:36:30 PDT 2017
On 29/08/2017, Halfdan Ingvarsson <halfdan at gmail.com> wrote:
> The original snippet compiles fine. The problem occurs when you try to
> constexpr the 'c' variable:
>
>
> typedef int v4si __attribute__ ((vector_size (16)));
>
> int main()
> {
> constexpr v4si a = {1,2,3,4};
> constexpr v4si b = {2,0,0,0};
> constexpr v4si c = a + b;
> }
> -----
> Output:
>
> constexpr v4si c = a + b;
> ~
> error: constexpr variable 'c' must be initialized by a constant expression
> -----
>
> https://godbolt.org/g/KYBmsB
Thank you, Halfdan. This is exactly what I meant.
Tom
More information about the cfe-dev
mailing list