public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: ballan@c425089-a.plstn1.sfba.home.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/4190: digraph interference in class names
Date: Fri, 31 Aug 2001 20:56:00 -0000	[thread overview]
Message-ID: <20010901034932.30080.qmail@sourceware.cygnus.com> (raw)

>Number:         4190
>Category:       c++
>Synopsis:       digraph interference in class names
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 31 20:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Ben Allan
>Release:        gcc 2.95.3 through 3.0
>Organization:
>Environment:
Linux z 2.2.17-14 #1 Mon Feb 5 18:48:50 EST 2001 i686 unknown
>Description:
(submission duplicates post on bugs mailing list, per request
of one of the list readers.)

dynamic_cast<T>(v) misparsed for
fully qualified T from global namespace, e.g.
dynamic_cast<::ns::type *>(base_of_type_pointer);
<::ns bound to tokens '<:', the [ digraph 
(observed by Nathan Sidwell). 
This is a manifestation similar to report 1566 (1546?)

The following example demonstrates:
namespace n1 {
  class foo {
  public:
    virtual ~foo() {}
    virtual void doIt()  =0;
  };

  class bar : public virtual foo {
  public:
    bar() {}
    virtual ~bar() {}
    void doIt()  { i=2;}
  private:
    int i;
  };

} ;
extern void exit(int c);
int main() {

  ::n1::foo *fp2 = 0;
  ::n1::bar b;
 
  bp = &b;

  fp2 = dynamic_cast<::n1::foo *>(bp); // what business has a digraph here
  fp2 = dynamic_cast< ::n1::foo * >(bp); //workaround
  if (fp2 == 0) { exit(2); }
  return 0;
}
>How-To-Repeat:

>Fix:
Workaround:
insert whitespace around the T argument of all dynamic_casts.
Fixes?:
Get the precedence right for digraphs in contexts where
digraphs have no business being. 
If the iso spec is broken advocate fixing it. 
If neither of those, include the --no-digraphs
switch on the compiler. 
Perhaps use @ as the digraph lead instead of delimiters.
Just go back to trigraphs and forget digraphs.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-08-31 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-31 20:56 ballan [this message]
2001-09-01  2:15 neil

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=20010901034932.30080.qmail@sourceware.cygnus.com \
    --to=ballan@c425089-a.plstn1.sfba.home.com \
    --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).