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

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, I see also warnings on your testcase,
warning: ignoring attributes on template argument 'VectorElementType' {aka
'__m512'} [-Wignored-attributes]
and
warning: ignoring attributes on template argument '__m512'
[-Wignored-attributes]
though am not sure if it isn't just a false positive.
/* Since type attributes aren't mangled, we need to strip them from
   template type arguments.  */

tree
canonicalize_type_argument (tree arg, tsubst_flags_t complain)
{
  if (!arg || arg == error_mark_node || arg == TYPE_CANONICAL (arg))
    return arg;
  bool removed_attributes = false;
  tree canon = strip_typedefs (arg, &removed_attributes);
  if (removed_attributes
      && (complain & tf_warning))
    warning (OPT_Wignored_attributes,
             "ignoring attributes on template argument %qT", arg);
  return canon;
}

The rationale is clear, but for the vector_size attribute it I think got
already transformed into a VECTOR_TYPE earlier and so it probably doesn't
ignore it.
At least I see

void foo (std::vector<__m512>)
{
}
being mangled as _Z3fooSt6vectorIDv16_fSaIS0_EE aka
foo(std::vector<float vector[16], std::allocator<float vector[16]>>).

Trying
template <typename T>
T *
bar ()
{
  return new T ();
}

__m512 *x = bar <__m512> ();

template <typename T>
struct S
{
  using type = T;
  T *baz () { return new type (); }
};

__m512 *y = S <__m512> {}.baz ();
I also see the warning (just on the last line there) but see
_ZnwmSt11align_val_t calls in both bar and baz.

Reply via email to