public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: andrew@andypo.net
To: gcc-gnats@gcc.gnu.org
Subject: c++/9155: [3.4 regression] new parser rejects legal use of typeid(xxx).name()
Date: Fri, 03 Jan 2003 10:46:00 -0000	[thread overview]
Message-ID: <20030103103615.7534.qmail@sources.redhat.com> (raw)


>Number:         9155
>Category:       c++
>Synopsis:       [3.4 regression] new parser rejects legal use of typeid(xxx).name()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 03 02:46:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Pollard
>Release:        gcc-3.4-20030102
>Organization:
>Environment:
i686-pc-linux-gnu/RedHat8.0 on a PIII
>Description:
The following code snippet gets an error when compiled with gcc-3.4-20030102

gcc-3.4-20021224 (pre-new parser) works...

typeid.cxx:
-------------------
#include <typeinfo>

struct A {
    virtual ~A() {}
};

void
foo(A* a)
{
    typeid(*a).name();
}

void
bar(A* a)
{
    const std::type_info& t = typeid(*a);
    t.name();
}
-------------------

% g++34 typeid.cxx
typeid.cxx: In function `void foo(A*)':
typeid.cxx:10: error: request for member `std::type_info::name() const' in `
   __cxa_bad_typeid()()', which is of non-class type `const std::type_info&'

Note how 'bar(A*)' compiles fine.

Is this a parser bug, or is this the standard mandated behaviour? (I'd guess a bug...)
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-01-03 10:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03 10:46 andrew [this message]
2003-01-03 16:19 paolo

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=20030103103615.7534.qmail@sources.redhat.com \
    --to=andrew@andypo.net \
    --cc=gcc-gnats@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).