This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Template operator compile error in 3.0.4, not in 2.95.2


Let's try replying back to the list and not to myself :-)

More information....

This is obviously trying to compile my own code, not compile part of gcc.

The source line that fails is...

    lhs == rhs

where lhs is of type FIXEDSTRING<16>, and rhs is of type UNICODE*
FIXEDSTRING is a template class too big to bother including here.  It's
basically a way to define a class member as a fixed with string and do
bounds checking on all assignments so some fool can't accidentally copy
something too long to fit into it and trash whatever's after it in memory.
UNICODE is just a typedef for unsighed short.

It turns out that if I cast rhs to a const UNICODE*, it compiles just fine.

My remaining question is "why is this an error and not a warning?"


----- Original Message -----
From: "Dave Williss" <dwilliss@microimages.com>
To: <gcc-bugs@gcc.gnu.org>
Sent: Thursday, May 16, 2002 11:45 AM
Subject: Template operator compile error in 3.0.4, not in 2.95.2


> edittabg.c:7796: choosing `bool FIXEDSTRING<_T>::operator==(const
UNICODE*)
>    const [with long unsigned int _T = 16]' over `operator=='
> edittabg.c:7796:   because worst conversion for the former is better than
> worst
>    conversion for the latter
>
> Why is this an error?  I _want_ it to choose the template's == operator.
>
> This is with g++ 3.0.4.  It worked fine in 2.95.2
>
>  -- Dave Williss
> ------
> Meddle not in the affairs of dragons,
>    for you are crunchy and taste good with catsup


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]