public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Wolfgang Bangerth <bangerth@math.ethz.ch> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/6601: [parser] Parse error when using :: qualified name in template Date: Thu, 16 May 2002 01:06:00 -0000 [thread overview] Message-ID: <20020516080604.23982.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/6601; it has been noted by GNATS. From: Wolfgang Bangerth <bangerth@math.ethz.ch> To: Reiner Hauser <rhauser@fnal.gov> Cc: gcc-gnats@gcc.gnu.org, <lerdsuwa@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <gcc-patches@gcc.gnu.org>, <pfeifer@dbai.tuwien.ac.at> Subject: Re: c++/6601: [parser] Parse error when using :: qualified name in template Date: Thu, 16 May 2002 10:05:23 +0200 (CEST) > Thanks, who would have thought about di-graphs ;) ? I hesitated a while > to submit a bug report, because I thought somebody else surely must have > caught this before. I finally did it since the Kai compiler compiled the > code without complaints, but it turns out that it has digraphs disabled > in the default mode and you have to give some --strict option to enable > them. > > Maybe this can go into that 'bugs which aren't really bugs' web page you > got ? It might give people a clue when they run into similar problems. I append a patch to bugs.html below which lists this as a non-bug. It might be worthwhile for both 3.1 and 3.2. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@math.ethz.ch www: http://www.math.ethz.ch/~bangerth Index: bugs.html =================================================================== RCS file: /cvsroot/gcc/wwwdocs/htdocs/bugs.html,v retrieving revision 1.56 diff -c -r1.56 bugs.html *** bugs.html 14 May 2002 17:23:17 -0000 1.56 --- bugs.html 16 May 2002 07:56:59 -0000 *************** *** 614,619 **** --- 614,643 ---- <a href="http://www.validlab.com/goldberg/paper.ps">this paper</a> for more information.</p></dd> + <dt><em>Templates, scoping, and digraphs.</em></dt> + + <dd><p>If you have a class in global namespace, say named + <code>X</code>, and want to give it as a template argument to some + other class, say <code>std::vector</code>, then this here fails with a + parser error: <code>std::vector<::X></code>. + </p> + + <p> + The reason is that the standard mandates that the sequence + <code><:</code> is treated as if it were the token + <code>[</code>, and the parser then reports a parse error before the + character <code>:</code> (by which it means the second + colon). There are several such combinations of characters, and + they are called <em>di-graphs</em>. + </p> + + <p> + The simplest way to avoid this is to write <code>std::vector< + ::X></code>, i.e. place a space between the opening angle bracket + and the scope operator. + </p></dd> + + </dl> <h3><a name="missing">Missing features</a></h3>
next reply other threads:[~2002-05-16 8:06 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-05-16 1:06 Wolfgang Bangerth [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-05-17 14:26 Jason Merrill 2002-05-16 14:26 John Marshall 2002-05-16 13:56 Gabriel Dos Reis 2002-05-16 13:26 Nathan Sidwell 2002-05-16 13:06 Neil Booth 2002-05-16 11:56 Gerald Pfeifer 2002-05-14 8:36 Reiner Hauser 2002-05-14 7:36 Wolfgang Bangerth 2002-05-14 7:00 lerdsuwa
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=20020516080604.23982.qmail@sources.redhat.com \ --to=bangerth@math.ethz.ch \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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: linkBe 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).