https://llvm.org/bugs/show_bug.cgi?id=24564
Bug ID: 24564 Summary: Clang failed to discard const quilifier Product: clang Version: trunk Hardware: All OS: All Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: rajendra...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Sample 'c' code: #include <stdio.h> int main() { const int k = 5; int *kptr = &k; *kptr = 7; printf("%d\n", k); return 0; } The output of program is '5' not '7'. The clang shows a warning test.c:6:9: warning: initializing 'int *' with an expression of type 'const int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] int *kptr = &k; As per the warning clang has to ignore the 'const' qualifier & update the value to 7. But it does not update it. I tried this with latest GCC it does throw a similar warning & update the value to 7. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs