[LLVMbugs] [Bug 23642] New: -Wincompatible-pointer-types-discards-qualifiers should note the particular discarded qualifiers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 22 14:05:23 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23642

            Bug ID: 23642
           Summary: -Wincompatible-pointer-types-discards-qualifiers
                    should note the particular discarded qualifiers
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathan at codesourcery.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang 3.6 does this:

$ cat cc.c
int main() {
 char * c;
 char const ** c2 = &c;
}
$ clang cc.c
cc.c:3:16: warning: initializing 'const char **' with an expression of type
'char **' discards qualifiers in nested pointer types
[-Wincompatible-pointer-types-discards-qualifiers]
 char const ** c2 = &c;
               ^    ~~
1 warning generated.


It would be very nice if something like this were emitted instead:
cc.c:3:16: warning: initializing 'const char **' with an expression of type
'char **' discards qualifiers in nested pointer types
[-Wincompatible-pointer-types-discards-qualifiers]
 char const ** c2 = &c;
               ^    ~~
cc.c:3:7: note: nested pointer type with discarded 'const' qualifier
 char const ** c2 = &c;
 ---- ^^^^^ -

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150522/7e2dfebd/attachment.html>


More information about the llvm-bugs mailing list