shared memory cannot be statically initialized. It must be initialized manually using kernel code. Therefore const doesn’t make sense with shared.
device is not necessary when using the shared qualifier.
A shared definition like this:
shared float MyArray;
is valid and is considered a “static” definition.
You can also create a shared definition like this:
extern shared float MyArray;
which is considered a dynamically allocated shared variable. This method requires the size (in bytes) of the allocation to be specified at kernel launch time using a kernel launch config parameter.
Niether approach allows for static initialization.
As little_jimmy points out, the constant variable definition may be more suited to what you are trying to accomplish (or perhaps just a global const variable definition - this can be used in device code as well.)
You can read more about these various options in the programming guide and there are many cuda sample codes that demonstrate usage.