Use "__typeof__" instead of "typeof" for getref() macro

This is a very simple fix meant to prevent compiler warnings.
Still uses gcc/clang extensions...