https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124415

--- Comment #4 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
This is really a question about design of the GNU vector types. I think it's
also fair to say that Clang & EDG get this wrong if they do something different
to GCC, since GCC defined the extension.

I currently have a slight preference for the (more explicit) status quo. That
said, when I call AVX512 builtins, I often need to pass a zero vector of a
specific type. I don't care about the type, only about the zero. And yes, I
also tried '{}' and it felt strange that it doesn't work.

Clang also doesn't accept everything
(https://compiler-explorer.com/z/GTErMG6K8):

using V [[gnu::vector_size(16)]] = int;

V works()
{
  [](V) {}(V{1, 2, 3});
  [](const V&) {}(V{1, 2, 3});
  V r = {1, 2, 3};
  return r;
}

V doesnt_work()
{
  [](V) {}({1, 2, 3});        // Clang rejects
  [](const V&) {}({1, 2, 3}); // Clang rejects
  return {1, 2, 3};           // Clang accepts
}

Reply via email to