c++/10187: string literal converted to non-const `char[]' when used as argument to function template

bangerth@dealii.org bangerth@dealii.org
Fri Mar 21 23:44:00 GMT 2003


Synopsis: string literal converted to non-const `char[]' when used as argument to function template

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Fri Mar 21 23:24:53 2003
State-Changed-Why:
    By 2.13.4.1, 
      An ordinary string literal has type "array of n const
      char"  and  static storage duration (_basic.stc_), where n is the size
      of the string as defined below, and  is  initialized  with  the  given
      characters.
    
    To get the effect you want, declare a function
      template <int N>
      int foo (const char (&x)[N])
      {}
    

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10187



More information about the Gcc-bugs mailing list