From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-id: <20010901034932.30080.qmail@sourceware.cygnus.com> X-SW-Source: 2001-08/msg00755.html List-Id: >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(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: