This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]