public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/4190: digraph interference in class names
@ 2001-08-31 20:56 ballan
  0 siblings, 0 replies; 2+ messages in thread
From: ballan @ 2001-08-31 20:56 UTC (permalink / raw)
  To: gcc-gnats

>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/4190: digraph interference in class names
@ 2001-09-01  2:15 neil
  0 siblings, 0 replies; 2+ messages in thread
From: neil @ 2001-09-01  2:15 UTC (permalink / raw)
  To: ballan, gcc-bugs, gcc-prs, nobody

Synopsis: digraph interference in class names

State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Sat Sep  1 02:15:17 2001
State-Changed-Why:
    Digraphs are part of the standard; if you don't like it you need to get the
    standard changed.  I don't want a -no-digraphs option.
    Your code might only break on GCC now, but it will break on other
    compilers too in the future.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4190&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-09-01  2:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-31 20:56 c++/4190: digraph interference in class names ballan
2001-09-01  2:15 neil

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).