diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/Lexer/constants.c | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/Lexer/constants.c')
-rw-r--r-- | clang/test/Lexer/constants.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/clang/test/Lexer/constants.c b/clang/test/Lexer/constants.c new file mode 100644 index 0000000..2903885 --- /dev/null +++ b/clang/test/Lexer/constants.c @@ -0,0 +1,69 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -trigraphs %s + +int x = 000000080; // expected-error {{invalid digit}} + +int y = 0000\ +00080; // expected-error {{invalid digit}} + + + +float X = 1.17549435e-38F; +float Y = 08.123456; + +// PR2252 +#if -0x8000000000000000 // should not warn. +#endif + + +int c[] = { + 'df', // expected-warning {{multi-character character constant}} + '\t', + '\\ +t', + '??!', // expected-warning {{trigraph converted to '|' character}} + 'abcd' // expected-warning {{multi-character character constant}} +}; + +// PR4499 +int m0 = '0'; +int m1 = '\\\''; // expected-warning {{multi-character character constant}} +int m2 = '\\\\'; // expected-warning {{multi-character character constant}} +int m3 = '\\\ +'; + + +#pragma clang diagnostic ignored "-Wmultichar" + +int d = 'df'; // no warning. +int e = 'abcd'; // still warn: expected-warning {{multi-character character constant}} + +#pragma clang diagnostic ignored "-Wfour-char-constants" + +int f = 'abcd'; // ignored. + +// rdar://problem/6974641 +float t0[] = { + 1.9e20f, + 1.9e-20f, + 1.9e50f, // expected-warning {{too large}} + 1.9e-50f, // expected-warning {{too small}} + -1.9e20f, + -1.9e-20f, + -1.9e50f, // expected-warning {{too large}} + -1.9e-50f // expected-warning {{too small}} +}; +double t1[] = { + 1.9e50, + 1.9e-50, + 1.9e500, // expected-warning {{too large}} + 1.9e-500, // expected-warning {{too small}} + -1.9e50, + -1.9e-50, + -1.9e500, // expected-warning {{too large}} + -1.9e-500 // expected-warning {{too small}} +}; + +// PR7888 +double g = 1e100000000; // expected-warning {{too large}} + +char h = '\u1234'; // expected-error {{character too large for enclosing character literal type}} |