summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/trad/literals-1.c
blob: 15c8030fa550033c615e8f9da067909ce7206f23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Test that (what looks like) comments are not recognized in literals
   and that quotes within quotes do not confused the preprocessor.  */

/* { dg-do run } */

extern void abort (void);

int main ()
{
  const char *str1 = "/*";
  const char *str2 = "'";

  if (str1[0] != '/' || str1[1] != '*' || str1[2] != '\0')
    abort ();

  if (str2[0] != '\'' || str2[1] != '\0')
    abort ();

#if '"' != '\"'
#  error /* { dg-bogus "error" "double quote in charconst" } */
#endif

#if !'\''
#  error quote /* { dg-bogus "quote" "quote in charconst" } */
#endif

  return 0;
}