public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/2988: Incorrect error on assignment of const char[] to char *
@ 2001-05-29  5:16 ros
  0 siblings, 0 replies; 2+ messages in thread
From: ros @ 2001-05-29  5:16 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2988
>Category:       c++
>Synopsis:       Incorrect error on assignment of const char[] to char *
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue May 29 05:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     ros@tao-group.com
>Release:        gcc version 2.95.2 20000220 (Debian GNU/Linux)
>Organization:
>Environment:
Debian GNU/Linux 2.2
>Description:
>From C++ Programming Language 3rd Ed 5.2.2:

The type of a string literal is ... const char[n];
A string literal can be assigned to char *

The compiler fails to allow this in conditional expressions.

(Verified still a problem using codesourcery with build
2001-05-28.)
>How-To-Repeat:
compile attached; default options suffice. Observe message

assignment to `char *' from `const char *' discards qualifiers 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="ros2.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ros2.cc"

aW50Cm1haW4gKGludCBhcmdjLCBjaGFyICoqYXJndikKewogIGNoYXIgKmFyZ3NbNF07CiAgaW50
IGZsYWdzOwoKICAvLyB0aGlzIGZhaWxzCgogIGFyZ3NbMV0gPSAoZmxhZ3M9PTApID8gKGNoYXIg
KikiLW4iIDogKGNoYXIgKikiLXAiOwoKICAvLyB0aGlzIGVxdWl2YWxlbnQgY29kZSB3b3Jrcwog
CiAgaWYgKGZsYWdzPT0wKSAKICAgIGFyZ3NbMV0gPSAiLW4iOwogIGVsc2UKICAgIGFyZ3NbMV0g
PSAiLXAiOwoKICByZXR1cm4gMDsKfQo=


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/2988: Incorrect error on assignment of const char[] to char *
@ 2001-06-14 19:10 rodrigc
  0 siblings, 0 replies; 2+ messages in thread
From: rodrigc @ 2001-06-14 19:10 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, ros

Synopsis: Incorrect error on assignment of const char[] to char *

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Thu Jun 14 19:10:03 2001
State-Changed-Why:
    Your test case compiles without error and without warning
    with: gcc version 3.0 20010614 (prerelease)

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2988&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-14 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-29  5:16 c++/2988: Incorrect error on assignment of const char[] to char * ros
2001-06-14 19:10 rodrigc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).