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]

[Bug c++/24667] New: -Wcast-qual fails to reject offending cast


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


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