Gab has been debugging a failure that goes like this: In testsuite/g++.dg/pph/x1functions.h: struct type { int mbr_decl_then_def(int); int mbr_decl_inline(int i) { } }
In testsuite/g++.dg/pph/x1functions.cc: #include "x1functions.h" int type::mbr_decl_then_def(int i) { return mbr_decl_inline( i ); } We first compile x1functions.h into x1functions.pph. Then we compile x1functions.cc with $ gcc -fpph-hdr=x1functions x1functions.cc This causes the #include directive to ignore x1functions.h and instead load x1functions.pph. So, the parser really starts parsing at the first token of x1functions.cc. The problem starts when it then tries to lookup the IDENTIFIER_NODE mbr_decl_inline. It fails to realize that the identifier is the FUNCTION_DECL type::mbr_decl_inline(). We have been tracing why the name lookup fails and it seems that this is failing because mbr_decl_inline does not have a proper IDENTIFIER_BINDINGS set. At first, we thought that maybe we were not streaming this field out, but the parser removes and reattaches different binding information using scope_chain->bindings. In fact, scope_chain has a lot of state that I think needs to be saved in each pph image. I am still not too sure how the parser uses the various fields in scope_chain, but it seems to be keeping lists and stacks as it goes in and out of classes and types during parsing. Since we told it to skip the header file text, when it started parsing the .cc file, none of the state that it would've collected while parsing the .h file was present. Am I on the right track? My impression is that for each header file that we pre-parse we should save this state in scope_chain. The issue then becomes, given more than one pph image, how should the different scope_chains be merged? Thanks. Diego.