Interresting; the bug doesn't show up when I call foo() directly from hilfe, just when it's called via apply_current():
DD()->BB("")->foo(2,([]),"","");
apply_external(1, 1, 4)... -find_external_context(1, inherit=2) - i->parent_offset=1 i->parent_identifier=1 - o->parent_identifier=0 inherit->identifier_level=2 - inherit-- (2 >= 2) -find_external_context(1, inherit=1) - i->parent_offset=1 i->parent_identifier=80 - o->parent_identifier=0 inherit->identifier_level=0 - inherit-- (1 >= 1) -find_external_context(1, inherit=0) - i->parent_offset=-18 i->parent_identifier=-1 - o->parent_identifier=0 inherit->identifier_level=0 - Following o->parent - Parent identifier = 0 (BB), inherit # = 0 --find_external_context: parent_id=0 (BB) * inh->parent_identifier: 80 * loc->parent_identifier: 0 * loc->inherit->parent_offset: -18 * loc->inherit->identifier_level: 0 * parent_identifier: 80 - Parent identifier = 80 (BB), inherit # = 2 --find_external_context: parent_id=80 (BB) * inh->parent_identifier: 1 * loc->parent_identifier: 80 * loc->inherit->parent_offset: 0 * loc->inherit->identifier_level: 0 * parent_identifier: 1 - Parent identifier = 1 (AA), inherit # = 3 --find_external_context: parent_id=1 (AA) apply_external(1, 1, 4) ==> apply_low(0x83c4ee0, 2, 4)