From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path:
Received: (qmail 24044 invoked by alias); 16 May 2002 08:06:08 -0000
Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Archive:
List-Post:
List-Help:
Sender: gcc-prs-owner@gcc.gnu.org
Received: (qmail 23986 invoked by uid 71); 16 May 2002 08:06:04 -0000
Date: Thu, 16 May 2002 01:06:00 -0000
Message-ID: <20020516080604.23982.qmail@sources.redhat.com>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
From: Wolfgang Bangerth
Subject: Re: c++/6601: [parser] Parse error when using :: qualified name in
template
Reply-To: Wolfgang Bangerth
X-SW-Source: 2002-05/txt/msg00441.txt.bz2
List-Id:
The following reply was made to PR c++/6601; it has been noted by GNATS.
From: Wolfgang Bangerth
To: Reiner Hauser
Cc: gcc-gnats@gcc.gnu.org, , ,
,
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 ----
this paper
for more information.
+ Templates, scoping, and digraphs.
+
+ If you have a class in global namespace, say named
+ X
, and want to give it as a template argument to some
+ other class, say std::vector
, then this here fails with a
+ parser error: std::vector<::X>
.
+
+
+
+ The reason is that the standard mandates that the sequence
+ <:
is treated as if it were the token
+ [
, and the parser then reports a parse error before the
+ character :
(by which it means the second
+ colon). There are several such combinations of characters, and
+ they are called di-graphs.
+
+
+
+ The simplest way to avoid this is to write std::vector<
+ ::X>
, i.e. place a space between the opening angle bracket
+ and the scope operator.
+
+
+