aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pascal-strings-3.C
blob: 7c7cf8139ed7334a8889dcadec2e9bece20f4dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* APPLE LOCAL file pascal strings */
/* Ensure that there are no warnings or errors issued when a Pascal string is used to
   initialize an array and the NUL terminator does not fit.  */
/* Author: Ziemowit Laski <zlaski@apple.com> */

/* { dg-do compile } */
/* { dg-options "-fpascal-strings" } */

typedef unsigned char Str15[16];

Str15 ggg = "\p012345678901234";
Str15 hhh = "\p0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */

int foo(void)
{
  Str15 sss = "\p012345678901234";
  Str15 ttt = "\p0123456789012345"; /* { dg-error "initializer.string for array of chars is too long" } */

  return 0;
}