2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -trigraphs %s
|
2007-07-16 14:55:01 +08:00
|
|
|
|
2009-04-29 02:43:12 +08:00
|
|
|
int x = 000000080; // expected-error {{invalid digit}}
|
2007-07-16 14:55:01 +08:00
|
|
|
|
|
|
|
int y = 0000\
|
2009-04-29 02:43:12 +08:00
|
|
|
00080; // expected-error {{invalid digit}}
|
2007-07-16 14:55:01 +08:00
|
|
|
|
2009-04-29 02:43:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
float X = 1.17549435e-38F;
|
|
|
|
float Y = 08.123456;
|
|
|
|
|
|
|
|
// PR2252
|
|
|
|
#if -0x8000000000000000 // should not warn.
|
|
|
|
#endif
|
2009-04-29 02:52:02 +08:00
|
|
|
|
|
|
|
|
2010-11-10 06:22:12 +08:00
|
|
|
int c[] = {
|
2009-04-29 05:51:46 +08:00
|
|
|
'df', // expected-warning {{multi-character character constant}}
|
2009-04-29 02:52:02 +08:00
|
|
|
'\t',
|
|
|
|
'\\
|
|
|
|
t',
|
2009-04-29 05:51:46 +08:00
|
|
|
'??!', // expected-warning {{trigraph converted to '|' character}}
|
|
|
|
'abcd' // expected-warning {{multi-character character constant}}
|
2009-04-29 02:52:02 +08:00
|
|
|
};
|
|
|
|
|
2010-07-08 07:24:27 +08:00
|
|
|
// PR4499
|
|
|
|
int m0 = '0';
|
|
|
|
int m1 = '\\\''; // expected-warning {{multi-character character constant}}
|
|
|
|
int m2 = '\\\\'; // expected-warning {{multi-character character constant}}
|
|
|
|
int m3 = '\\\
|
|
|
|
';
|
|
|
|
|
2009-04-29 02:52:02 +08:00
|
|
|
|
2009-05-13 02:21:11 +08:00
|
|
|
#pragma clang diagnostic ignored "-Wmultichar"
|
2009-04-29 02:52:02 +08:00
|
|
|
|
2010-11-10 06:22:12 +08:00
|
|
|
int d = 'df'; // no warning.
|
|
|
|
int e = 'abcd'; // still warn: expected-warning {{multi-character character constant}}
|
2009-04-29 05:51:46 +08:00
|
|
|
|
2009-05-13 02:21:11 +08:00
|
|
|
#pragma clang diagnostic ignored "-Wfour-char-constants"
|
2009-04-29 05:51:46 +08:00
|
|
|
|
2010-11-10 06:22:12 +08:00
|
|
|
int f = 'abcd'; // ignored.
|
2009-12-24 17:08:04 +08:00
|
|
|
|
|
|
|
// rdar://problem/6974641
|
|
|
|
float t0[] = {
|
|
|
|
1.9e20f,
|
|
|
|
1.9e-20f,
|
2010-02-27 07:35:57 +08:00
|
|
|
1.9e50f, // expected-warning {{too large}}
|
|
|
|
1.9e-50f, // expected-warning {{too small}}
|
2009-12-24 17:08:04 +08:00
|
|
|
-1.9e20f,
|
|
|
|
-1.9e-20f,
|
2010-02-27 07:35:57 +08:00
|
|
|
-1.9e50f, // expected-warning {{too large}}
|
|
|
|
-1.9e-50f // expected-warning {{too small}}
|
2009-12-24 17:08:04 +08:00
|
|
|
};
|
|
|
|
double t1[] = {
|
|
|
|
1.9e50,
|
|
|
|
1.9e-50,
|
2010-02-27 07:35:57 +08:00
|
|
|
1.9e500, // expected-warning {{too large}}
|
|
|
|
1.9e-500, // expected-warning {{too small}}
|
2009-12-24 17:08:04 +08:00
|
|
|
-1.9e50,
|
|
|
|
-1.9e-50,
|
2010-02-27 07:35:57 +08:00
|
|
|
-1.9e500, // expected-warning {{too large}}
|
|
|
|
-1.9e-500 // expected-warning {{too small}}
|
2009-12-24 17:08:04 +08:00
|
|
|
};
|
2010-08-20 03:13:24 +08:00
|
|
|
|
|
|
|
// PR7888
|
|
|
|
double g = 1e100000000; // expected-warning {{too large}}
|
2011-08-19 11:20:12 +08:00
|
|
|
|
|
|
|
char h = '\u1234'; // expected-warning {{character unicode escape sequence too long for its type}}
|