This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24667] New: -Wcast-qual fails to reject offending cast
- From: "fang at csl dot cornell dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Nov 2005 06:11:36 -0000
- Subject: [Bug c++/24667] New: -Wcast-qual fails to reject offending cast
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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