Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356955

Summary: Overloaded operator not resolvable
Product: [Tools] CDT Reporter: Lukas Felber <l.felber>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Lukas Felber CLA 2011-09-07 11:35:28 EDT
Build Identifier: I20110613-1736

In the following code example, ctrl+click does not work on "+" (code line 12 in main.cpp). ctrl+clicking on operator "-" (which is not overloaded in struct "inter") works fine.

As far as I figured out, all of the following conditions must be met to have the error occur:
 * member-function doSomething() must be inside of struct "sub"
 * struct "base" must be in a header file
 * type of "left" and "right" must be "base"

Reproducible: Always

Steps to Reproduce:
code:
//main.cpp
#include"base.h"

struct inter : public base {
  virtual void operator+(base const &){}
};

struct sub : public inter {
  void doSomething() {
    base *left, *right;

    *left + *right;
    *left - *right;
  }
};

//base.h
struct base {
  virtual void operator+(base const &) { }
  virtual void operator-(base const &) { }
};
Comment 1 Markus Schorn CLA 2011-09-08 09:29:15 EDT
Thanks for the example, added testcase and fix.
Comment 2 CDT Genie CLA 2011-09-08 10:23:02 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 356955: Lookup for overloaded operator.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=42eaf65363a629f592bb8fafad43c544f251ed91
Comment 3 CDT Genie CLA 2011-09-19 08:23:04 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 356955: Follow up porting fix to 8.0.2.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=2f327be2bed4576945708a2abb631ba625638cd5
Comment 4 CDT Genie CLA 2011-09-19 08:23:09 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 356955: Lookup for overloaded operator.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=7902fd1c77d602dbcde4bc3d00b8a8675746d9e7