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

Bug 356268

Summary: Name resolution problem with 'using' declaration inside a class
Product: [Tools] CDT Reporter: Sergey Prigogin <eclipse.sprigogin>
Component: cdt-parserAssignee: Sergey Prigogin <eclipse.sprigogin>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0Flags: mschorn.eclipse: review+
Target Milestone: 8.0.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed fix and test case cdtdoug: iplog-, mschorn.eclipse: review+

Description Sergey Prigogin CLA 2011-08-30 23:05:57 EDT
class A {
public:
  void method(A);
};

class B : public A {
public:
  void method(B);
  using A::method;
};

class C : public B {
};

void test() {
  B b;
  C c;
  c.method(b);  // 'method' is unresolved
}

The error message is:
'method' is ambiguous '
Candidates are:
void method(B)
void method(A)
'
Comment 1 Sergey Prigogin CLA 2011-09-01 01:41:44 EDT
Created attachment 202581 [details]
Proposed fix and test case

Markus, could you please review the fix. The existing code for detecting lookup ambiguity is not correct, but I'm not sure if the proposed one is.
Comment 2 Markus Schorn CLA 2011-09-01 04:33:59 EDT
Comment on attachment 202581 [details]
Proposed fix and test case

The approach looks correct to me. There is a bug in the method collectResult(): The method ArrayUtil.addAll() expects all trailing entries to be null (not just a single one).
Comment 3 Sergey Prigogin CLA 2011-09-01 15:09:48 EDT
(In reply to comment #2)
> The approach looks correct to me. There is a bug in the method collectResult():
> The method ArrayUtil.addAll() expects all trailing entries to be null (not just
> a single one).

There is no bug. I've clarified javadoc in ArrayUtil.
Comment 4 Sergey Prigogin CLA 2011-09-01 16:34:41 EDT
Fixed in master and cdt_8_0 > 20110901.
Comment 5 CDT Genie CLA 2011-09-01 17:23:01 EDT
*** cdt git genie on behalf of Sergey Prigogin ***

    Bug 356268 - Name resolution problem with 'using' declaration inside a
    class. Fix and test case.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=e6d138a358e1eca344b5285c89f4ffbbca551b08
Comment 6 CDT Genie CLA 2011-09-01 17:23:03 EDT
*** cdt git genie on behalf of Sergey Prigogin ***

    Bug 356268 - Name resolution problem with 'using' declaration inside a
    class. Fix and test case.

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