blob: 3de20cb0fda3aa626198f7279da9a32ea6724e02 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wshorten-64-to-32 -triple x86_64-apple-darwin %s
John McCalldc767a12009-11-07 09:03:53 +00002
3int test0(long v) {
Douglas Gregor27f46ee2010-07-09 18:18:35 +00004 return v; // expected-warning {{implicit conversion loses integer precision}}
John McCalldc767a12009-11-07 09:03:53 +00005}
Chris Lattnerb792b302011-06-14 04:51:15 +00006
7
8// rdar://9546171
9typedef int int4 __attribute__ ((vector_size(16)));
10typedef long long long2 __attribute__((__vector_size__(16)));
11
12int4 test1(long2 a) {
13 int4 v127 = a; // no warning.
14 return v127;
15}
David Blaikie37050842012-04-12 22:40:54 +000016
17int test2(long v) {
18 return v / 2; // expected-warning {{implicit conversion loses integer precision: 'long' to 'int'}}
19}