public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24667]  New: -Wcast-qual fails to reject offending cast
@ 2005-11-04  6:11 fang at csl dot cornell dot edu
  2005-11-04  7:47 ` [Bug c++/24667] " fang at csl dot cornell dot edu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fang at csl dot cornell dot edu @ 2005-11-04  6:11 UTC (permalink / raw)
  To: gcc-bugs

g++ -Wcast-qual doesn't seem to reject the following code, it just accepts
quitely without warning.  

//======= "foo.cc" ==================
int main(int, char**) {
const int foo[2] = {1,1};
((int*)foo)[0] = 0;
}
//=========================

command: g++ -Wcast-qual foo.cc

program output: (none)

expected output (from g++ 3.3):
foo.cc: In function `int main(int, char**)':
foo.cc:3: warning: cast from `const int*' to `int*' discards qualifiers from 
   pointer target type

keywords: accepts-invalid

known to work: 3.3.x
known to fail: 4.0.2

remarks: possibly closely related to PR 20475

Originator: Dmitry Markman <dmarkman at mac dot com>, reported on
xcode-users@lists.apple.com.
(I wasn't able to add him to the CC list.)


-- 
           Summary: -Wcast-qual fails to reject offending cast
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fang at csl dot cornell dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24667


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

end of thread, other threads:[~2005-11-15 17:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-04  6:11 [Bug c++/24667] New: -Wcast-qual fails to reject offending cast fang at csl dot cornell dot edu
2005-11-04  7:47 ` [Bug c++/24667] " fang at csl dot cornell dot edu
2005-11-04 14:33 ` [Bug c++/24667] [4.0/4.1 Regression] -Wcast-qual fails to reject offending cast for a old style cast pinskia at gcc dot gnu dot org
2005-11-04 17:56 ` fang at csl dot cornell dot edu
2005-11-04 21:18 ` janis at gcc dot gnu dot org
2005-11-15 17:50 ` [Bug c++/24667] [4.0/4.1 Regression] -Wcast-qual fails to warn about " mmitchel at gcc dot gnu dot org
2005-11-15 17:52 ` mmitchel at gcc dot gnu dot org
2005-11-15 17:57 ` mmitchel at gcc dot gnu dot org

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).