summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/expr/cond1.C
blob: 8fb3c0f4f34b4fcfee3f28d32484878ba10ef7a1 (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
// { dg-do run }

// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 17 Oct 2002 <nathan@codesourcery.com>

// PR 7209. We didn't SAVE_EXPR in the right place

char a[2][1][16]={
  {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
  {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}};

int f() {return 0;}

char * Foo (int d)
{
  char *c1;

  c1=a[d==0 ? 0 : 1][f()];

  return c1;
}

int main ()
{
  if (Foo (0) != (void *)a)
    return 1;
  return 0;
}