[llvm-bugs] [Bug 27131] New: -Wincompatible-pointer-types treats constnat strings as NSString even when -fconstant-string-class is used

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 30 05:37:33 PDT 2016


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

            Bug ID: 27131
           Summary: -Wincompatible-pointer-types treats constnat strings
                    as NSString even when -fconstant-string-class is used
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pete at twisted.org.uk
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

When using an alternative class for constant strings (i.e. I am not using OS X
or GNUStep ) then warning for incompatible types are generated, which appear to
be based on still using NSString as the class of the constant string. For
example this code:

    MyConstStr *s;
    s = @"foo";

will generate this error

test.m:21:7: warning: incompatible pointer types assigning to 'MyConstStr *'
from 'NSString *' [-Wincompatible-pointer-types]
    s = @"foo";


This works fine under gcc 4 and 5. Note that the resulting code works fine, it
is just the warning which is wrong.

-- 
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/20160330/adbcf811/attachment.html>


More information about the llvm-bugs mailing list