https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99642

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Type and spec are the messages facet, but the same problem happens with other
types.  A simpler test case is:

$ (set -x && cat pch.h && cat main.cpp)
+ cat pch.h
#include <iosfwd>
+ cat main.cpp
#include <ios>
#include "pch.h"
int main () {}

which aborts for basic_istream (and basic_ostream, but no other types).

The problem is that some of these types are added to class2loc mapping as they
should be, but with a different address than when they're looked up. 
Instrumenting the code to print out the tree node (as @%p) shows this.  The
address after type_decl, @0x7fdba48705f0, in the first message, doesn't match
the address after spec, @0x10001df1f0:

/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/iosfwd:83:11: note:
add: type_decl @0x7fdba48705f0: ‘class std::basic_istream<_CharT, _Traits>’,
exist: 0, def_p: 0, complete: 0, template_decl: 1
   83 |     class basic_istream;
      |           ^~~~~~~~~~~~~
and then
/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/iosfwd:83:11: note:
diag_mismatched_tags: type_decl: ‘class std::basic_istream<_CharT, _Traits>’
   83 |     class basic_istream;
      |           ^~~~~~~~~~~~~
main.cpp:3:14: note: diag_mismatched_tags: type: ‘std::basic_istream<_CharT,
_Traits>’, spec @0x10001df1f0: ‘std::basic_istream<_CharT, _Traits>’
    3 | int main () {}
      |              ^

A record of basic_istream exists but can't be looked up.

Reply via email to