Xcode's dispatch_after causes CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION

Originator:heath.borders
Number:rdar://11738695 Date Originated:25-Jun-2012 10:24 AM
Status:Open Resolved:
Product:iPad SDK Product Version:5.1
Classification:Other Bug Reproducible:Always
 
25-Jun-2012 10:24 AM Heath Borders:
Summary:
Xcode's dispatch_after template

double delayInSeconds = 2.0;
double delayInNanoSeconds = delayInSeconds * NSEC_PER_SEC;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInNanoSeconds);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
});

causes the following warning from CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION

Implicit conversion turns floating-point number into integer: 'double' to 'int64_t' (aka 'long long')

because

delayInNanoSeconds is converted from a double to an int64_t implicitly

Steps to Reproduce:
type "dispatch_after" into a function context in Xcode

Expected Results:
A code template that is free of warnings

Actual Results:
Implicit conversion turns floating-point number into integer: 'double' to 'int64_t' (aka 'long long')

Regression:

Notes:
Explicit casting stops the warning:

dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)delayInNanoSeconds);

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!