[LLVMbugs] [Bug 9082] New: Clang should emit pedantic warnings for conversions to/from pointers to qualifier arrays

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 28 01:20:28 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9082

           Summary: Clang should emit pedantic warnings for conversions
                    to/from pointers to qualifier arrays
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rjmccall at apple.com
                CC: llvmbugs at cs.uiuc.edu


According to the C standard, conversions like the following are technically
casting away const-ness, because array types are never qualified:  qualifiers
apply only to the element type.
  const void *    -> const int (*)[5]
  const int *       -> const int (*)[5]

Similarly, this is not supposed to be a valid qualification conversion:
  int (*)[10]    ->  const int (*)[10]

These are kindof arbitrary restrictions that do make life unnecessarily
difficult for real users;  I think clang's model (where the array and element
are simultaneously qualified) really makes a lot more sense.  Nonetheless, we
should at the very least provide -pedantic warnings about these conversions not
being permitted by the standard(s).

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list