egcs/g++ Compiler error when using :: at start of template parameter name

Nathan Sidwell nathan@acm.org
Fri Apr 30 23:15:00 GMT 1999


Smithers, Kit wrote:
> 
> The attached files illustrate a compiler error when using a :: at the start
> of a template parameter:
> 
>         typedef MyClass<::String> MyStringClass2;
> 
> The code can be made to compile by inserting a space between the < and the
> :: as in:
> 
>         typedef MyClass< ::String> MyStringClass2;
> 
> I'm informed that the problem also occurs in egcs1.1.2 although I have only
> personally tried egcs1.1.1
You've stumbled over digraphs. these are described in 2.5/2 of the standard. In
your case the character pair `<:' has the same meaning as `['. Thus you'd
effectively written,
	typedef MyClass[:String> MyStringClass2;

So, not a bug.

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk



More information about the Gcc-bugs mailing list