This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Question about overloaded operators
- From: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>
- To: Jason Merrill <jason at redhat dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 11 Nov 2013 00:58:33 +0000
- Subject: RE: Question about overloaded operators
- Authentication-results: sourceware.org; auth=none
- References: <BF230D13CA30DD48930C31D4099330003A49D122 at FMSMSX101 dot amr dot corp dot intel dot com> <527FD68F dot 6090202 at redhat dot com>
> -----Original Message-----
> From: Jason Merrill [mailto:jason@redhat.com]
> Sent: Sunday, November 10, 2013 1:55 PM
> To: Iyer, Balaji V; gcc@gcc.gnu.org
> Subject: Re: Question about overloaded operators
>
> On 11/10/2013 11:08 AM, Iyer, Balaji V wrote:
> > In C++, when a binary/unary operator is overloaded, then the
> build_x_[binary/unary]_op replaces it with a call expression. Is there a way
> to know from the call expression (assume we are in the gimplification stage)
> what the operator is? I tried to look around but I didn't find any obvious way
> to figure this info out.
>
> Not a simple one. You might factor out the code for that in
> write_unqualified_id into a separate function.
>
Semi crazy thought...If I do something like a string compare for the operation after operator toward the end of the function, will I get what I want? I guess another way to ask this is, will a '+' operation, for example, be mapped to a function ending in something other than "operator+"
> Jason