//ww:run // migrated from test/wcc/949_xmod_fnptr_const_run.c: cross-module &cc.fn inside const table + scalar emits the &fn->DATAR reloc (#124); DISTINCT predicates catch a swapped reloc. package cc; export fn isa(c: rune) bool = { return c == 'a'; }; export fn isz(c: rune) bool = { return c == 'z'; }; package main; import cc; const tbl: [](str, *fn(c: rune) bool) = [(":a", &cc.isa), (":z", &cc.isz)]; const pf: *fn(c: rune) bool = &cc.isa; export fn main() i32 = { if (len(tbl) != 2) { return 10; }; let e0 = tbl[0]; let e1 = tbl[1]; let f0 = e0.1; let f1 = e1.1; if (!(*f0)('a')) { return 1; }; if ((*f0)('z')) { return 2; }; if (!(*f1)('z')) { return 3; }; if ((*f1)('a')) { return 4; }; if (!(*pf)('a')) { return 5; }; if ((*pf)('z')) { return 6; }; return 0; };