diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java index c5cccbe6766..7c155a08974 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2013 IBM Corporation and others. + * Copyright (c) 2004, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator; import org.eclipse.cdt.core.dom.ast.IField; import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNameSpecifier; @@ -325,9 +326,15 @@ public class CPPASTQualifiedName extends CPPASTNameBase @Override public IBinding[] findBindings(IASTName n, boolean isPrefix, String[] namespaces) { IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix, namespaces); - + if (fQualifierPos >= 0) { IBinding binding = fQualifier[fQualifierPos].resolveBinding(); + + while (binding instanceof ITypedef) { + ITypedef typedef = (ITypedef) binding; + binding = (IBinding) typedef.getType(); + } + if (binding instanceof ICPPClassType) { ICPPClassType classType = (ICPPClassType) binding; final boolean isDeclaration = getParent().getParent() instanceof IASTSimpleDeclaration; diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java index ffd6cd8f83b..8e0065511bc 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java @@ -17,6 +17,11 @@ *******************************************************************************/ package org.eclipse.cdt.ui.tests.text.contentassist2; +import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.CONTEXT; +import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.DISPLAY; +import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.ID; +import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.REPLACEMENT; + import java.io.File; import java.io.IOException; import java.util.HashSet; @@ -36,8 +41,6 @@ import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference; -import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.*; - /** * A collection of code completion tests. * @@ -99,6 +102,7 @@ public class CompletionTests extends AbstractContentAssistTest { // void m1private(); // }; // typedef C1 T1; + // using A1 = C1; // // class C2 : public T1 { // public: @@ -667,8 +671,7 @@ public class CompletionTests extends AbstractContentAssistTest { //# d/*cursor*/ public void testCompletePreprocessorDirective2() throws Exception { final String[] expected= { "define " }; - assertCompletionResults(fCursorOffset, expected, - REPLACEMENT); + assertCompletionResults(fCursorOffset, expected, REPLACEMENT); } //# if d/*cursor*/ @@ -691,6 +694,18 @@ public class CompletionTests extends AbstractContentAssistTest { assertCompletionResults(fCursorOffset, expected, ID); } + //void f(){T1::~/*cursor*/ + public void testTypedefSyntheticMembers_415495() throws Exception { + final String[] expected= {}; + assertCompletionResults(fCursorOffset, expected, REPLACEMENT); + } + + //void f(){A1::~/*cursor*/ + public void testAliasSyntheticMembers_415495() throws Exception { + final String[] expected= {}; + assertCompletionResults(fCursorOffset, expected, REPLACEMENT); + } + // struct A {}; // // template