constants.c revision 295a637416d4bddf5b3d766d9f630a0028596176
1// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -trigraphs %s 2 3int x = 000000080; // expected-error {{invalid digit}} 4 5int y = 0000\ 600080; // expected-error {{invalid digit}} 7 8 9 10float X = 1.17549435e-38F; 11float Y = 08.123456; 12 13// PR2252 14#if -0x8000000000000000 // should not warn. 15#endif 16 17 18char c[] = { 19 'df', // expected-warning {{multi-character character constant}} 20 '\t', 21 '\\ 22t', 23 '??!', // expected-warning {{trigraph converted to '|' character}} 24 'abcd' // expected-warning {{multi-character character constant}} 25}; 26 27// PR4499 28int m0 = '0'; 29int m1 = '\\\''; // expected-warning {{multi-character character constant}} 30int m2 = '\\\\'; // expected-warning {{multi-character character constant}} 31int m3 = '\\\ 32'; 33 34 35#pragma clang diagnostic ignored "-Wmultichar" 36 37char d = 'df'; // no warning. 38char e = 'abcd'; // still warn: expected-warning {{multi-character character constant}} 39 40#pragma clang diagnostic ignored "-Wfour-char-constants" 41 42char f = 'abcd'; // ignored. 43 44// rdar://problem/6974641 45float t0[] = { 46 1.9e20f, 47 1.9e-20f, 48 1.9e50f, // expected-warning {{too large}} 49 1.9e-50f, // expected-warning {{too small}} 50 -1.9e20f, 51 -1.9e-20f, 52 -1.9e50f, // expected-warning {{too large}} 53 -1.9e-50f // expected-warning {{too small}} 54}; 55double t1[] = { 56 1.9e50, 57 1.9e-50, 58 1.9e500, // expected-warning {{too large}} 59 1.9e-500, // expected-warning {{too small}} 60 -1.9e50, 61 -1.9e-50, 62 -1.9e500, // expected-warning {{too large}} 63 -1.9e-500 // expected-warning {{too small}} 64}; 65 66// PR7888 67double g = 1e100000000; // expected-warning {{too large}} 68