public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon
@ 2012-09-08 13:10 tsoae at mail dot ru
  2012-09-25  9:41 ` [Bug c++/54526] [C++11] " paolo.carlini at oracle dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: tsoae at mail dot ru @ 2012-09-08 13:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

             Bug #: 54526
           Summary: <:: is incorrectly treated as digraph <: followed by
                    colon
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tsoae@mail.ru


g++ 4.8.0 20120826 (experimental) fails to compile the following well-defined
code:

    template <class T>
        struct X {};

    struct A {};

    int main()
    {
        X<::A> x; // error: ‘<::’ cannot begin a template-argument list
    }

According to C++11 - 2.5 p3, bullet 2:

If the input stream has been parsed into preprocessing tokens up to a given
character:
... if the next three characters are <:: and the subsequent character is
neither : nor >, the < is treated as a preprocessor token by itself and not as
the first character of the alternative token <:.

Compiler version info:

Target: i686-pc-linux-gnu
Configured with: .../configure --prefix=.../target --enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20120826 (experimental) (GCC)

Command line:

g++ test.cpp -std=c++11 -pedantic-errors

Diagnostic message:

test.cpp: In function ‘int main()’:
test.cpp:8:10: error: ‘<::’ cannot begin a template-argument list
[-fpermissive]
         X<::A> x;
          ^
test.cpp:8:10: note: ‘<:’ is an alternate spelling for ‘[’. Insert whitespace
between ‘<’ and ‘::’
test.cpp:8:10: note: (if you use ‘-fpermissive’ G++ will accept your code)


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
@ 2012-09-25  9:41 ` paolo.carlini at oracle dot com
  2012-09-25 14:45 ` paolo at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-25  9:41 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-09-25
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-25 09:40:49 UTC ---
On it.


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
  2012-09-25  9:41 ` [Bug c++/54526] [C++11] " paolo.carlini at oracle dot com
@ 2012-09-25 14:45 ` paolo at gcc dot gnu.org
  2012-09-25 14:46 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-09-25 14:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-09-25 14:44:58 UTC ---
Author: paolo
Date: Tue Sep 25 14:44:52 2012
New Revision: 191712

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191712
Log:
/cp
2012-09-25  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/54526
    * parser.c (cp_parser_template_id): In C++11 mode simply accept
    X<::A>.

/testsuite
2012-09-25  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/54526
    * g++.dg/cpp0x/parse2.C: New.
    * g++.dg/parse/error11.C: Adjust.
    * g++.dg/parse/error12.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/parse2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/parse/error11.C
    trunk/gcc/testsuite/g++.dg/parse/error12.C


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
  2012-09-25  9:41 ` [Bug c++/54526] [C++11] " paolo.carlini at oracle dot com
  2012-09-25 14:45 ` paolo at gcc dot gnu.org
@ 2012-09-25 14:46 ` paolo.carlini at oracle dot com
  2012-10-28  5:21 ` richard-gccbugzilla at metafoo dot co.uk
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-25 14:46 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-25 14:46:21 UTC ---
Fixed.


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (2 preceding siblings ...)
  2012-09-25 14:46 ` paolo.carlini at oracle dot com
@ 2012-10-28  5:21 ` richard-gccbugzilla at metafoo dot co.uk
  2012-10-28 11:00 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2012-10-28  5:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

--- Comment #4 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> 2012-10-28 05:21:40 UTC ---
The fix does not appear to be correct. C++11 changed the lexing rules, not the
parsing rules for template argument lists. For instance, this is valid in
C++11:

int a;
bool b = 0<::a;


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (3 preceding siblings ...)
  2012-10-28  5:21 ` richard-gccbugzilla at metafoo dot co.uk
@ 2012-10-28 11:00 ` paolo.carlini at oracle dot com
  2012-11-06  1:01 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-28 11:00 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-28 10:59:50 UTC ---
You are right, sorry. I have a lexer patch in testing which I will be sending
shortly.


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (4 preceding siblings ...)
  2012-10-28 11:00 ` paolo.carlini at oracle dot com
@ 2012-11-06  1:01 ` paolo.carlini at oracle dot com
  2013-01-01 21:00 ` ppluzhnikov at google dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-06  1:01 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-06 01:01:23 UTC ---
Follow up patch submitted as:

  http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00337.html


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (5 preceding siblings ...)
  2012-11-06  1:01 ` paolo.carlini at oracle dot com
@ 2013-01-01 21:00 ` ppluzhnikov at google dot com
  2013-01-01 22:24 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ppluzhnikov at google dot com @ 2013-01-01 21:00 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppluzhnikov at google dot
                   |                            |com

--- Comment #7 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2013-01-01 20:59:58 UTC ---
(In reply to comment #6)
> Follow up patch submitted as:
>   http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00337.html

This patch does not appear to have actually been committed to trunk (yet).

Paolo?


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (6 preceding siblings ...)
  2013-01-01 21:00 ` ppluzhnikov at google dot com
@ 2013-01-01 22:24 ` paolo.carlini at oracle dot com
  2013-01-02  9:13 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-01 22:24 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-01 22:24:03 UTC ---
I don't have much to say, the patch is still awaiting approval. Frankly, I
don't personally consider the issue very serious and definitely isn't a
regression, at this point we could as well leave the lexer alone for 4.8.


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (7 preceding siblings ...)
  2013-01-01 22:24 ` paolo.carlini at oracle dot com
@ 2013-01-02  9:13 ` paolo.carlini at oracle dot com
  2013-01-04 15:30 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-02  9:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-02 09:12:53 UTC ---
Let's keep this open.


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (8 preceding siblings ...)
  2013-01-02  9:13 ` paolo.carlini at oracle dot com
@ 2013-01-04 15:30 ` paolo at gcc dot gnu.org
  2013-01-04 15:32 ` paolo.carlini at oracle dot com
  2013-03-23 23:13 ` paolo.carlini at oracle dot com
  11 siblings, 0 replies; 13+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-01-04 15:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

--- Comment #10 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2013-01-04 15:30:32 UTC ---
Author: paolo
Date: Fri Jan  4 15:30:24 2013
New Revision: 194909

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194909
Log:
/libcpp
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/54526 (again)
    * lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.

/gcc/cp
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/54526 (again)
    * parser.c (cp_parser_template_id): Revert core of previous change
    (keep adjusted inform message).

/gcc/testsuite
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/54526 (again)
    * g++.dg/cpp0x/parse2.C: Extend.
    * g++.old-deja/g++.other/crash28.C: Adjust.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/parse2.C
    trunk/gcc/testsuite/g++.old-deja/g++.other/crash28.C
    trunk/libcpp/ChangeLog
    trunk/libcpp/lex.c


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (9 preceding siblings ...)
  2013-01-04 15:30 ` paolo at gcc dot gnu.org
@ 2013-01-04 15:32 ` paolo.carlini at oracle dot com
  2013-03-23 23:13 ` paolo.carlini at oracle dot com
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-04 15:32 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-04 15:32:18 UTC ---
Done again.


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

* [Bug c++/54526] [C++11] <:: is incorrectly treated as digraph <: followed by colon
  2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
                   ` (10 preceding siblings ...)
  2013-01-04 15:32 ` paolo.carlini at oracle dot com
@ 2013-03-23 23:13 ` paolo.carlini at oracle dot com
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-23 23:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54526

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmehlich at semanticdesigns
                   |                            |dot com

--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-23 23:12:57 UTC ---
*** Bug 56702 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2013-03-23 23:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-08 13:10 [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon tsoae at mail dot ru
2012-09-25  9:41 ` [Bug c++/54526] [C++11] " paolo.carlini at oracle dot com
2012-09-25 14:45 ` paolo at gcc dot gnu.org
2012-09-25 14:46 ` paolo.carlini at oracle dot com
2012-10-28  5:21 ` richard-gccbugzilla at metafoo dot co.uk
2012-10-28 11:00 ` paolo.carlini at oracle dot com
2012-11-06  1:01 ` paolo.carlini at oracle dot com
2013-01-01 21:00 ` ppluzhnikov at google dot com
2013-01-01 22:24 ` paolo.carlini at oracle dot com
2013-01-02  9:13 ` paolo.carlini at oracle dot com
2013-01-04 15:30 ` paolo at gcc dot gnu.org
2013-01-04 15:32 ` paolo.carlini at oracle dot com
2013-03-23 23:13 ` paolo.carlini at oracle dot com

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