1*f4a2713aSLionel Sambuc /* RUN: %clang_cc1 -std=c90 -fsyntax-only %s -verify -pedantic-errors
2*f4a2713aSLionel Sambuc */
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc enum { cast_hex = (long) (
5*f4a2713aSLionel Sambuc 0x0p-1 /* expected-error {{hexadecimal floating constants are a C99 feature}} */
6*f4a2713aSLionel Sambuc ) };
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc /* PR2477 */
test1(int a,int b)9*f4a2713aSLionel Sambuc int test1(int a,int b) {return a//* This is a divide followed by block comment in c89 mode */
10*f4a2713aSLionel Sambuc b;}
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc // comment accepted as extension /* expected-error {{// comments are not allowed in this language}}
13*f4a2713aSLionel Sambuc
test2()14*f4a2713aSLionel Sambuc void test2() {
15*f4a2713aSLionel Sambuc const char * str =
16*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds" // expected-error{{string literal of length 845 exceeds maximum length 509 that C90 compilers are required to support}}
17*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
18*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
19*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
20*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
21*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
22*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
23*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
24*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
25*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
26*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
27*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
28*f4a2713aSLionel Sambuc "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds";
29*f4a2713aSLionel Sambuc }
30*f4a2713aSLionel Sambuc
test3()31*f4a2713aSLionel Sambuc void test3() {
32*f4a2713aSLionel Sambuc (void)L"\u1234"; // expected-error {{universal character names are only valid in C99 or C++}}
33*f4a2713aSLionel Sambuc (void)L'\u1234'; // expected-error {{universal character names are only valid in C99 or C++}}
34*f4a2713aSLionel Sambuc }
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambuc #define PREFIX(x) foo ## x
test4()37*f4a2713aSLionel Sambuc int test4() {
38*f4a2713aSLionel Sambuc int PREFIX(0p) = 0;
39*f4a2713aSLionel Sambuc int *p = &PREFIX(0p+1);
40*f4a2713aSLionel Sambuc return p[-1];
41*f4a2713aSLionel Sambuc }
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel Sambuc #define MY_UCN \u00FC // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}}
44*f4a2713aSLionel Sambuc #define NOT_A_UCN \h // no-warning
45*f4a2713aSLionel Sambuc
46*f4a2713aSLionel Sambuc extern int idWithUCN\u00FC; // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}} expected-error {{expected ';'}}
47