Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wshorten-64-to-32 -triple x86_64-apple-darwin %s |
John McCall | dc767a1 | 2009-11-07 09:03:53 +0000 | [diff] [blame] | 2 | |
| 3 | int test0(long v) { |
Douglas Gregor | 27f46ee | 2010-07-09 18:18:35 +0000 | [diff] [blame] | 4 | return v; // expected-warning {{implicit conversion loses integer precision}} |
John McCall | dc767a1 | 2009-11-07 09:03:53 +0000 | [diff] [blame] | 5 | } |
Chris Lattner | b792b30 | 2011-06-14 04:51:15 +0000 | [diff] [blame] | 6 | |
| 7 | |
| 8 | // rdar://9546171 |
| 9 | typedef int int4 __attribute__ ((vector_size(16))); |
| 10 | typedef long long long2 __attribute__((__vector_size__(16))); |
| 11 | |
| 12 | int4 test1(long2 a) { |
| 13 | int4 v127 = a; // no warning. |
| 14 | return v127; |
| 15 | } |
David Blaikie | 3705084 | 2012-04-12 22:40:54 +0000 | [diff] [blame] | 16 | |
| 17 | int test2(long v) { |
| 18 | return v / 2; // expected-warning {{implicit conversion loses integer precision: 'long' to 'int'}} |
| 19 | } |