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: unassignedclangb...@nondot.org
          Reporter: mayer.jul...@googlemail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to