Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356268 - Name resolution problem with 'using' declaration inside a class
Summary: Name resolution problem with 'using' declaration inside a class
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.0.1   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-30 23:05 EDT by Sergey Prigogin CLA
Modified: 2012-05-22 20:42 EDT (History)
1 user (show)

See Also:
mschorn.eclipse: review+


Attachments
Proposed fix and test case (4.74 KB, patch)
2011-09-01 01:41 EDT, Sergey Prigogin CLA
cdtdoug: iplog-
mschorn.eclipse: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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