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