<div dir="ltr">The original snippet compiles fine. The problem occurs when you try to constexpr the 'c' variable:<div><br><div><br></div><div><span style="font-size:12.8px">typedef int v4si __attribute__ ((vector_size (16)));</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">int main()</span><br style="font-size:12.8px"><span style="font-size:12.8px">{</span><br style="font-size:12.8px"><span style="font-size:12.8px"> constexpr v4si a = {1,2,3,4};</span><br style="font-size:12.8px"><span style="font-size:12.8px"> constexpr v4si b = {2,0,0,0};</span><br style="font-size:12.8px"><span style="font-size:12.8px"> constexpr v4si c = a + b;</span><br style="font-size:12.8px"><span style="font-size:12.8px">}</span><br></div></div><div><span style="font-size:12.8px">-----</span></div><div>Output:</div><div><br></div><div><font face="monospace, monospace"><span style="font-size:12.8px">constexpr v4si c = a + b;</span><br style="font-size:12.8px"></font></div><div><font face="monospace, monospace"><span style="font-size:12.8px"> ~</span></font></div><div><span style="font-family:monospace,monospace;font-size:12.8px">error: constexpr variable 'c' must be initialized by a constant expression</span><br></div><div class="gmail_extra"><div><div class="m_-5239246707279902259gmail_signature">-----</div><div class="m_-5239246707279902259gmail_signature"><br></div><div class="m_-5239246707279902259gmail_signature"><a href="https://godbolt.org/g/KYBmsB" target="_blank">https://godbolt.org/g/KYBmsB</a><br></div><div class="m_-5239246707279902259gmail_signature"><br> - ½<br></div></div>
<br><div class="gmail_quote">On 29 August 2017 at 14:36, Jeff Hammond via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I see no errors with Clang 3.8, 3.9, 4.0 and GCC 5, 6, 7 on my Haswell Mac. Try setting -std= appropriately, given that constexpr is a C++11 feature.</div><div><br></div></div></blockquote></div></div></div>