public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/99642] Compiler error while using precompiled header and -Wmismatched-tags flag
Date: Thu, 18 Mar 2021 20:33:52 +0000	[thread overview]
Message-ID: <bug-99642-4-nIgaLaXFdw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99642-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2021-03-18 20:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 12:08 [Bug c++/99642] New: " alexey.ismagilov at rfdyn dot ru
2021-03-18 14:23 ` [Bug c++/99642] " msebor at gcc dot gnu.org
2021-03-18 14:30 ` msebor at gcc dot gnu.org
2021-03-18 20:33 ` msebor at gcc dot gnu.org [this message]
2021-12-14  7:23 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-99642-4-nIgaLaXFdw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).