This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/4190: digraph interference in class names
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4190: digraph interference in class names
- From: ballan at c425089-a dot plstn1 dot sfba dot home dot com
- Date: 1 Sep 2001 03:49:32 -0000
- Reply-To: ballan at c425089-a dot plstn1 dot sfba dot home dot com
>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: