void f(char* p)
{}
int main()
{
f("Hello"); // OK
auto p = "Hello";
f(p); // error C2664: 'void f(char *)' : cannot convert parameter 1
// from 'const char *' to 'char *'
}
The code was compiled with VC++ Nov 2012 CTP.
§2.14.15 String Literals, Section 7
A narrow string literal has type “array of n const char”, where n is the size of the string as defined below, and has static storage duration.
Why is f("Hello")
OK?