```
void g(string T)()
{
pragma(msg, "g ", T, " ", T.stringof);
}
void h(ubyte[] T)()
{
pragma(msg, "h ", T, " ", T.stringof);
}
void main()
{
g!"a"();
g!(['a'])();
h!(cast(ubyte[])"a")();
h!(['a'])();
}
```
Prints:
```
g a "a"
g a ['a']
h a "a"
h [cast(ubyte)97u] [cast(ubyte)97u]
```
Showing multiple instantiations are made. This is because internally, StringExp and ArrayLiteralExp are hashed/mangled differently. An improvement would be to consistently convert one to the other if possible.
Comment #1 by dkorpel — 2024-01-12T17:21:49Z
Related issue:
```D
void f(int[] b)() { }
void main()
{
enum dstring s = (""d ~ cast(dchar) 0xFFFF_FFFF);
f!(cast(int[]) s ~ []); // works
f!(cast(int[]) s); // invalid UCS-32 char \Uffffffff
}
```
Fails because it tries to mangle the int[] as a string because it's a StringExp.
Comment #2 by robert.schadek — 2024-12-13T19:32:30Z