This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon
- From: "tsoae at mail dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Sep 2012 13:10:37 +0000
- Subject: [Bug c++/54526] New: <:: is incorrectly treated as digraph <: followed by colon
- Auto-submitted: auto-generated
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)