constants.c revision 2a0d7574acaa3a8d516e9ae4b720755460ebe8a8
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 28#pragma clang diagnostic ignored "-Wmultichar" 29 30char d = 'df'; // no warning. 31char e = 'abcd'; // still warn: expected-warning {{multi-character character constant}} 32 33#pragma clang diagnostic ignored "-Wfour-char-constants" 34 35char f = 'abcd'; // ignored. 36 37// rdar://problem/6974641 38float t0[] = { 39 1.9e20f, 40 1.9e-20f, 41 1.9e50f, // expected-warning {{too large}} 42 1.9e-50f, // expected-warning {{too small}} 43 -1.9e20f, 44 -1.9e-20f, 45 -1.9e50f, // expected-warning {{too large}} 46 -1.9e-50f // expected-warning {{too small}} 47}; 48double t1[] = { 49 1.9e50, 50 1.9e-50, 51 1.9e500, // expected-warning {{too large}} 52 1.9e-500, // expected-warning {{too small}} 53 -1.9e50, 54 -1.9e-50, 55 -1.9e500, // expected-warning {{too large}} 56 -1.9e-500 // expected-warning {{too small}} 57}; 58