Or just do it in C.
#define span(T) struct span_##T { size_t len; T *data; }
#define span_access(T, x, i) (*({ \
span(T) *_v = (x); \
auto _i = (i); \
if (((size_t)_i) >= _v->len) abort(); \
&_v->data[_i]; \
}))
https://godbolt.org/z/TvxseshGcThe fact that pointer types can't be used with this pattern without typedef still seems kinda primitive to me.
Still requires a gcc/clang specific extension (although this one I'd be very happy to see standardized)