1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 422401 - [Content Assist] no binding for nested types of a base

class

The problem was with template base classes as in the unit test.
Accessibility check did not find the proper AccessContext.namingClass
and always ended further up in the class tree.

Change-Id: I447567cabd20ad5c57c05a9ffa5f0f12c5321ccf
Signed-off-by: Michi <woskimi@yahoo.de>
Reviewed-on: https://git.eclipse.org/r/38944
Tested-by: Hudson CI
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Michi 2015-01-04 15:18:12 +01:00 committed by Sergey Prigogin
parent ff7056130e
commit bb17286834
2 changed files with 22 additions and 0 deletions

View file

@ -286,6 +286,9 @@ public class AccessContext {
if (maxdepth > 0) {
for (ICPPBase cppBase : ClassTypeHelper.getBases(derived, point)) {
IBinding base= cppBase.getBaseClass();
if (base instanceof ICPPSpecialization) {
base = ((ICPPSpecialization) base).getSpecializedBinding();
}
if (base instanceof ICPPClassType) {
ICPPClassType tbase= (ICPPClassType) base;
if (tbase.isSameType(target)) {

View file

@ -735,6 +735,25 @@ public class CompletionTests extends AbstractContentAssistTest {
assertCompletionResults(fCursorOffset, expected, REPLACEMENT);
}
// template<typename T>
// struct Parent {
// protected:
// struct Nested {
// protected:
// using TParam = T;
// };
// };
//
// struct NestingTest: Parent<int> {
// struct A : Nested {
// TP/*cursor*/
// };
// };
public void testNestedBaseTemplateMembers_422401() throws Exception {
final String[] expected = { "TParam" };
assertCompletionResults(fCursorOffset, expected, ID);
}
// struct A {};
//
// template<typename T>