This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[PATCH] Test and support all cpp operator types


This patch adds testing and support for the following types of operator
lookup:
 - non-member operators.
 - imported operators (using directive, anonymous namespaces).
 - ADL operators.

If there are more, please let me know.

It also tests for overload resolution in the presence of combination of
the above.

In the implementation of this I have abandoned the use of
value_struct_elt and used find_overload_match instead. This eliminated
the duplicate implementation of eval-time lookup and brought the
benefits of overload resolution to operator evaluation.

Operators have the unique situation where it is not possible to tell
from the expression whether the intent is a member or non-member
operator eg:

class A {

  int operator==(int){
    return 0;
  }
}

int operator==(char){
  return 1;
}

A a;

(gdb) p a == 1

'find_overload_match' search is mutually exclusive; it performs either
method or non-method search if performed. So it had to be changed to
support the case above; I added a new search mode which would look for
both candidates and compare them to find the best result.

Thanks,
Sami

Attachment: operators.patch
Description: Text document


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