comparision operator ignore type cast operators 
Author Message
 comparision operator ignore type cast operators

Hi,

I think the following code should be valid. VC7 complains
about the comparision:

error C2677: binary '>=' : no global operator found which takes
type 'Foo' (or there is no acceptable conversion)

class Foo
{
public:
 operator int*()
 {
  return (int*)0;
 }

Quote:
};

int main()
{
 int* pi = (int*)0;
 Foo foo;

 bool b = pi < foo;    // C2627; explicit static_cast works fine

Quote:
}

Could someone please acknowlegde.

tia
Holger



Tue, 04 Jan 2005 03:36:31 GMT  
 comparision operator ignore type cast operators

Quote:

> error C2677: binary '>=' : no global operator found which takes
> type 'Foo' (or there is no acceptable conversion)

Forgot to mention:
error occurs for <,>,<=,>= but not for == and !=.

-hg



Tue, 04 Jan 2005 04:02:17 GMT  
 comparision operator ignore type cast operators
Definitely a bug.  Comeau accepts the code as-is.
-cd


Quote:
> Hi,

> I think the following code should be valid. VC7 complains
> about the comparision:

> error C2677: binary '>=' : no global operator found which takes
> type 'Foo' (or there is no acceptable conversion)

> class Foo
> {
> public:
>  operator int*()
>  {
>   return (int*)0;
>  }
> };

> int main()
> {
>  int* pi = (int*)0;
>  Foo foo;

>  bool b = pi < foo;    // C2627; explicit static_cast works fine
> }

> Could someone please acknowlegde.

> tia
> Holger



Tue, 04 Jan 2005 04:55:20 GMT  
 comparision operator ignore type cast operators
Acknowledged, and already fixed in internal builds of the upcoming release
sometimes called 7.1.

Jason Shirk
VC++ Compiler Team


Quote:
> Hi,

> I think the following code should be valid. VC7 complains
> about the comparision:

> error C2677: binary '>=' : no global operator found which takes
> type 'Foo' (or there is no acceptable conversion)

> class Foo
> {
> public:
>  operator int*()
>  {
>   return (int*)0;
>  }
> };

> int main()
> {
>  int* pi = (int*)0;
>  Foo foo;

>  bool b = pi < foo;    // C2627; explicit static_cast works fine
> }

> Could someone please acknowlegde.

> tia
> Holger



Tue, 04 Jan 2005 07:16:07 GMT  
 comparision operator ignore type cast operators
Jason,

Quote:
> Acknowledged, and already fixed in internal builds of the upcoming release
> sometimes called 7.1.

Thanks for your quick response.

Will there be a public Beta program for this version?. I'm eagerly waiting
for it.
Unfortunately I have no longer access to MSDN subscription (**don't ask**).

BTW: What happened to Brandon Bray? I loved to see these Cheerio! s
below each message.



Tue, 04 Jan 2005 08:55:40 GMT  
 comparision operator ignore type cast operators


Quote:
> Jason,

> > Acknowledged, and already fixed in internal builds of the upcoming
release
> > sometimes called 7.1.

> Thanks for your quick response.

> Will there be a public Beta program for this version?. I'm eagerly waiting
> for it.
> Unfortunately I have no longer access to MSDN subscription (**don't
ask**).

> BTW: What happened to Brandon Bray? I loved to see these Cheerio! s
> below each message.

There are no plans for a public beta, sorry.

Brandon is just down the hall but quite busy lately.  Cheerio!

Jason Shirk
VC++ Compiler Team



Wed, 05 Jan 2005 03:47:16 GMT  
 comparision operator ignore type cast operators
Thanks again Jason,

Quote:

> There are no plans for a public beta, sorry.

<Sigh/>.

Template class specializations for const types are quite some fun
with VC7.0.

Quote:
> Brandon is just down the hall but quite busy lately.  Cheerio!

I know it's just a single word -- but it helps!

Cheerio!

Holger



Sat, 08 Jan 2005 20:07:39 GMT  
 comparision operator ignore type cast operators

Quote:

> I know it's just a single word -- but it helps!

I am really looking forward to having time to read mail and news... I've
missed that tremendously in the past four months. I'm working doubly hard to
make sure I have that time very soon.

Cheerio!

--
Brandon Bray                    Visual C++ Compiler and CRT Program Manager
This posting is provided "AS IS" with no warranties, and confers no rights.



Mon, 17 Jan 2005 08:49:15 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Operator overloading and type cast

2. comparision operators for basic_string

3. comparision operators for basic_string

4. Compiler bug in operator[ ] and operator (type casting) overloading?

5. My operator delete is being ignored!

6. operator T() ignored?

7. Overloading operators P ++ and how to ignore P++ ++;

8. Math operators is C. Exponent operator?

9. Which is faster relational operator or equality operator?

10. VC++ 5.0 ambiguity: conversion operator vs overloaded operator?

11. Comma operator in #define's (was Re: Usage of comma operator)

12. MFC CString operator= conflicts with stl operator template

 

 
Powered by phpBB® Forum Software