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

--- Comment #11 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2025/p3802r0.pdf managed to
put into words what I was thinking wrt. reflection tying into this feature. The
target attribute (as well as fast-math related optimize attribute) changes the
state of what P3802 captures as __local_ctx.

So I guess I want to be able to write a function

consteval uint64_t
__target_traits(std::meta::info __c = __local_ctx) {
  // read target attribute state to build bit-mask
}

or a

__local_ctx<"target">

and then use it in default template arguments

template <typename T, typename Abi = __native_abi<T>(__target_traits())>
  class simd
  { ... };

A function such as

[[gnu::target_clones("default,avx,avx512f")]]
void f()
{ std::cout << simd<float>::size(); }

would then specialize simd<float> differently, because the __local_ctx is
different for each of the 3 clones.

Reply via email to