[llvm-bugs] [Bug 25151] New: obj-c generics does not warn when using wrong type in the 'for-in' loop

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 12 13:07:26 PDT 2015


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

            Bug ID: 25151
           Summary: obj-c generics does not warn when using wrong type in
                    the 'for-in' loop
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mayer.julian at googlemail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

obj-c lightweight generics does not warn when using wrong type in the 'for-in'
loop

even when using -Wall -Wextra, this compiles without warning with
Apple LLVM version 7.0.0 (clang-700.0.72) - but of course crashes at runtime:


NSMutableArray <NSString *> *stringArray = @[@"aa", @"ab"].mutableCopy;
for (NSURL *url in stringArray) // we should get a warning here because
stringArray contains NSStrings and not NSURLs
{
    NSLog(@"%@", url.path); // we get a crash here because 'url' really a
NSString and doesn't respond to 'path'
}

-- 
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/20151012/c39d29e8/attachment.html>


More information about the llvm-bugs mailing list