www.digitalmars.com         C & C++   DMDScript  

c++ - [bug] string literals should be const

According section 2.13.4 of the standard, a string literal has type 
"array of n const char". So this should work:

   template <class T>
   void test(T x)
       char const* y;
       T z = y;

   int main()

Although, section 4.2 specifies that a conversion is allowed to a 
non-const pointer. So this is still allowed:

   char* p = "abc";

But that's deprecated according to Annex D. It's also mentioned in C.1.1.

Jun 28 2005