1/* Copyright (C) 2001 Free Software Foundation, Inc.  */
2
3/* { dg-do compile } */
4
5/* This tests various diagnostics about character constants, for both
6   the preprocessor and the compiler.
7
8   Neil Booth, 22 May 2001.  */
9
10#if ''			/* { dg-error "empty" "empty charconst" } */
11#endif
12#if L''			/* { dg-error "empty" "empty wide charconst" } */
13#endif
14#if 'very long'		/* { dg-warning "too long" "long charconst" } */
15#endif
16#if L'very long'	/* { dg-warning "too long" "long wide charconst" } */
17#endif
18/* Don't do this test for L'ab'; it depends upon sizeof (wchar_t).  */
19#if 'ab'		/* { dg-warning "multi-char" "multi-character" } */
20#endif
21
22void foo ()
23{
24  int c;
25  __WCHAR_TYPE__ w;
26
27  c = '';		/* { dg-error "empty" "empty charconst" } */
28  w = L'';		/* { dg-error "empty" "empty wide charconst" } */
29
30  c = 'very long';	/* { dg-warning "too long" "long charconst" } */
31  w = L'very long';	/* { dg-warning "too long" "long wide charconst" } */
32
33  c = 'ab';		/* { dg-warning "multi-char" "multi-char" } */
34  /* Wide charconsts cannot contain more than one wide character.  */
35  w = L'ab';		/* { dg-warning "too long" "multi-char wide" } */
36}
37