summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3056.c
blob: 9ae13ec1866f3656a9772a5f075110932f294be8 (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
29
30
31
32
33
/*
   bug-3056.c - function name not promoted to function pointer
                inside conditional operator
 */

#include <testfwk.h>

unsigned char x;

void f1(void)
{
  x = 1;
}

void f2(void)
{
  x = 2;
}

void bug(int i)
{
  (i ? f1 : f2)();
}

void testBug(void)
{
  ASSERT(x == 0);
  bug(1);
  ASSERT(x == 1);
  bug(0);
  ASSERT(x == 2);
}