[Bug c++/17152] Useless error message

paavola at skycomputers dot com gcc-bugzilla@gcc.gnu.org
Mon Aug 23 14:22:00 GMT 2004


------- Additional Comments From paavola at skycomputers dot com  2004-08-23 14:22 -------
Subject: Re:  Useless error message

Hmmm - the message says "declaration of `operator==' as non-function". 
It looks like a function declaration to me.

It also says "expected `;' before '<' token", so I do get a clue that 
there's a problem with the "<>". Putting a `;' into the code would 
clearly be wrong.

I won't claim to be a C++ template wizard - perhaps someone more 
experienced would figure this out. In addition, gcc 3.3 was happy 
enough with this. As a minimum, you should document it in your 3.4 
release notes as a change from 3.3. I got the code that caused this bug 
report off the web. I suspect there's more of it out there.

Steve

On Aug 23, 2004, at 10:07 AM, bangerth at dealii dot org wrote:

>
> ------- Additional Comments From bangerth at dealii dot org  
> 2004-08-23 14:07 -------
> I think the error message is actually quite clear: you try to make
> something a friend which isn't known: for a friend declaration, if
> name lookup doesn't find an existing name, and if it is a declaration
> of either a function or a function template, then this injects the
> name into the surrounding namespace. However, this doesn't apply for
> a function template specialization, as in your case, if the actual
> template declaration isn't available. Thus the compiler complains
> that you are trying to declare something you can't declare (a 
> non-function,
> non-template). It should be obvious that the compiler can't do anything
> about it unless you provide a declaration of the general template.
>
> I leave it to others to decide whether we want to keep this PR and if 
> so
> how to change the error message. I personally would vote for closing 
> it.
>
> W.
>
> -- 
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17152
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>



-- 


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



More information about the Gcc-bugs mailing list