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: unassig...@gcc.gnu.org ReportedBy: ts...@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)