------- Comment #3 from zak at transversal dot com 2006-02-10 17:05 ------- After making the change suggested in comment #1, the following test case demonstrates the problem mentioned in comment #2.
$ g++ -Wall -pedantic -I. foo.cc && nm -A foo.o [no output] If you switch the name in the pragma implementation directive to "dir2/foo.h", then the implementations of *both* headers are output: foo.o: U __gxx_personality_v0 foo.o:00000000 W _ZN2A1C1Ev foo.o:00000000 W _ZN2A1C2Ev foo.o:00000000 W _ZN2A2C1Ev foo.o:00000000 W _ZN2A2C2Ev In 3.4.5, the implementation of the header with the matching pragma interface directive is correctly output in each case. I'm currently testing a patch that, in addition to the above change, removes all the uses of lbasename in this context (two in decl.c, one in lex.c and one in semantics.c, all in code specific to handling #pragma interface and introduced in revision 87786). // foo.cc #pragma implementation "dir1/foo.h" #include "dir1/foo.h" // dir1/foo.h #pragma interface "dir1/foo.h" #include "dir2/foo.h" struct A1 { A1() { } }; // dir2/foo.h #pragma interface "dir2/foo.h" struct A2 { A2() { } }; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26195