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