------- Additional Comments From mark at codesourcery dot com  2005-04-08 15:34 
-------
Subject: Re:  [4.0 Regression] anonymous types and templates
 and rejecting valid code

lars at trolltech dot com wrote:
> ------- Additional Comments From lars at trolltech dot com  2005-04-08 14:36 
> -------
> Hi Mark, 
>  
> (In reply to comment #3) 
> 
>>This code is invalid.  The use of ">>" requires the instantiation of the 
>>declaration of the overloaded "operator>>", but that instantiation fails 
> 
> because 
> 
>>one of the template argument is anonymous. 
> 
>  
> I don't see why the code is invalid. If you leave out the forward declaration 
> of the template operator everything compiles fine, as the values in the 
> anonymous enum get cast to integers, and the builtin operator>>(int, int) 
> applies. 

Lars --

As I said earlier in the thread, there is now an open DR about this 
issue.  So, it might be resolved either way, eventually.

But, what the standard says at present is that you do overload 
resolution on both operators.  That requires that you instantiate their 
declarations, and the instantiation of the one using anonymous enums is 
invalid.  There's nothing in the standard that says that you discard 
instantiations that don't work -- except in cases of SFINAE.  And SFINAE 
does not let you ignore all errors, as some people think; it's a very 
specific set.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19404

Reply via email to