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

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