public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tsoae at mail dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon
Date: Sat, 08 Sep 2012 13:10:00 -0000	[thread overview]
Message-ID: <bug-54526-4@http.gcc.gnu.org/bugzilla/> (raw)

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)


             reply	other threads:[~2012-09-08 13:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-08 13:10 tsoae at mail dot ru [this message]
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

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=bug-54526-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).