summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug1678803.c
blob: c866b024e43db0a7621f0680c2921f808fcad8a3 (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
34
35
36
37
38
/*
    bug 1678803
    This should not generate error 12 "called object is not a function".
*/

#include <testfwk.h>

typedef void (*func)(void);

void foo(void)
{
}

#ifdef __SDCC_mcs51
func GetFunc(void) __naked
{
  __asm

    ; some assembler code
    mov dptr,#_foo
#ifdef __SDCC_MODEL_HUGE
    mov B,#_foo>>16
    ljmp __sdcc_banked_ret
#else
    ret
#endif
  __endasm;
}
#endif

void testCaller(void)
{
#ifdef __SDCC_mcs51
  GetFunc()();
#endif

  ASSERT (1);
}