Ideally, but realistically, I have never heard of any major programming language that allows you to express "this function only accepts static constant string literal".
https://typing.python.org/en/latest/spec/literal.html#litera...
For Rust’s macros, a literal can be expressed as `$arg:lit`. This does allow other literals as well, such as int or float literals, but typically the generated code would only work for a string literal.
#define foo(x) ( \
(void)std::integral_constant<char, (x)[0]>::value, \
foo_impl(x) \
)
(the re-evaluation of x doesn't matter if it compiles). You can also use a user-defined literal which has a different ergonomic problem.