Consider the following type definition:
typedef int (&foo_t)[3];
or
using foo_t = int(&)[3];
When adding a const qualifier to the type, it is ignored:
int foo[3] = {1, 2, 3};
const foo_t fooref = foo;
fooref[0] = 4; // No error here
Or when I try to assign a const array to it:
const int foo[3] = {1, 2, 3};
const foo_t fooref = foo;
/* error: binding reference of type ‘foo_t’ {aka ‘int (&)[3]’} to ‘const int [3]’ discards qualifiers
const foo_t fooref = foo;
^~~ */
How can I add const to a typedef'ed array reference?