Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -trigraphs %s |
Chris Lattner | 136f93a | 2007-07-16 06:55:01 +0000 | [diff] [blame] | 2 | |
Chris Lattner | 2dec3a1 | 2009-04-28 18:43:12 +0000 | [diff] [blame] | 3 | int x = 000000080; // expected-error {{invalid digit}} |
Chris Lattner | 136f93a | 2007-07-16 06:55:01 +0000 | [diff] [blame] | 4 | |
| 5 | int y = 0000\ |
Chris Lattner | 2dec3a1 | 2009-04-28 18:43:12 +0000 | [diff] [blame] | 6 | 00080; // expected-error {{invalid digit}} |
Chris Lattner | 136f93a | 2007-07-16 06:55:01 +0000 | [diff] [blame] | 7 | |
Chris Lattner | 2dec3a1 | 2009-04-28 18:43:12 +0000 | [diff] [blame] | 8 | |
| 9 | |
| 10 | float X = 1.17549435e-38F; |
| 11 | float Y = 08.123456; |
| 12 | |
| 13 | // PR2252 |
| 14 | #if -0x8000000000000000 // should not warn. |
| 15 | #endif |
Chris Lattner | b77f41e | 2009-04-28 18:52:02 +0000 | [diff] [blame] | 16 | |
| 17 | |
| 18 | char c[] = { |
Chris Lattner | e3ad881 | 2009-04-28 21:51:46 +0000 | [diff] [blame] | 19 | 'df', // expected-warning {{multi-character character constant}} |
Chris Lattner | b77f41e | 2009-04-28 18:52:02 +0000 | [diff] [blame] | 20 | '\t', |
| 21 | '\\ |
| 22 | t', |
Chris Lattner | e3ad881 | 2009-04-28 21:51:46 +0000 | [diff] [blame] | 23 | '??!', // expected-warning {{trigraph converted to '|' character}} |
| 24 | 'abcd' // expected-warning {{multi-character character constant}} |
Chris Lattner | b77f41e | 2009-04-28 18:52:02 +0000 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | |
Chris Lattner | e8fa06e | 2009-05-12 18:21:11 +0000 | [diff] [blame] | 28 | #pragma clang diagnostic ignored "-Wmultichar" |
Chris Lattner | b77f41e | 2009-04-28 18:52:02 +0000 | [diff] [blame] | 29 | |
| 30 | char d = 'df'; // no warning. |
Chris Lattner | e3ad881 | 2009-04-28 21:51:46 +0000 | [diff] [blame] | 31 | char e = 'abcd'; // still warn: expected-warning {{multi-character character constant}} |
| 32 | |
Chris Lattner | e8fa06e | 2009-05-12 18:21:11 +0000 | [diff] [blame] | 33 | #pragma clang diagnostic ignored "-Wfour-char-constants" |
Chris Lattner | e3ad881 | 2009-04-28 21:51:46 +0000 | [diff] [blame] | 34 | |
| 35 | char f = 'abcd'; // ignored. |
John McCall | 94c939d | 2009-12-24 09:08:04 +0000 | [diff] [blame] | 36 | |
| 37 | // rdar://problem/6974641 |
| 38 | float t0[] = { |
| 39 | 1.9e20f, |
| 40 | 1.9e-20f, |
John McCall | 2a0d757 | 2010-02-26 23:35:57 +0000 | [diff] [blame] | 41 | 1.9e50f, // expected-warning {{too large}} |
| 42 | 1.9e-50f, // expected-warning {{too small}} |
John McCall | 94c939d | 2009-12-24 09:08:04 +0000 | [diff] [blame] | 43 | -1.9e20f, |
| 44 | -1.9e-20f, |
John McCall | 2a0d757 | 2010-02-26 23:35:57 +0000 | [diff] [blame] | 45 | -1.9e50f, // expected-warning {{too large}} |
| 46 | -1.9e-50f // expected-warning {{too small}} |
John McCall | 94c939d | 2009-12-24 09:08:04 +0000 | [diff] [blame] | 47 | }; |
| 48 | double t1[] = { |
| 49 | 1.9e50, |
| 50 | 1.9e-50, |
John McCall | 2a0d757 | 2010-02-26 23:35:57 +0000 | [diff] [blame] | 51 | 1.9e500, // expected-warning {{too large}} |
| 52 | 1.9e-500, // expected-warning {{too small}} |
John McCall | 94c939d | 2009-12-24 09:08:04 +0000 | [diff] [blame] | 53 | -1.9e50, |
| 54 | -1.9e-50, |
John McCall | 2a0d757 | 2010-02-26 23:35:57 +0000 | [diff] [blame] | 55 | -1.9e500, // expected-warning {{too large}} |
| 56 | -1.9e-500 // expected-warning {{too small}} |
John McCall | 94c939d | 2009-12-24 09:08:04 +0000 | [diff] [blame] | 57 | }; |