diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java index d7168f6dc2e..d4395274638 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java @@ -110,7 +110,9 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase IParameter[] pars= f.getParameters(); assertEquals(1, pars.length); IType type= pars[0].getType(); - assertTrue(type instanceof ICompositeType); + assertInstance(type, ITypedef.class); + type= ((ITypedef) type).getType(); + assertInstance(type, ICompositeType.class); } // typedef enum { @@ -130,9 +132,10 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase IParameter[] pars= f.getParameters(); assertEquals(1, pars.length); IType type= pars[0].getType(); + assertInstance(type, ITypedef.class); + type= ((ITypedef) type).getType(); + assertInstance(type, IEnumeration.class); assertTrue(type instanceof IEnumeration); -// type= ((ITypedef) type).getType(); -// assertTrue(type instanceof IEnumeration); } // int globalVar; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java index c47fdfde78b..ed320428f20 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java @@ -8,8 +8,8 @@ * Contributors: * QNX - Initial API and implementation * Andrew Ferguson (Symbian) + * Markus Schorn (Wind River Systems) *******************************************************************************/ - package org.eclipse.cdt.internal.core.pdom.dom.c; import org.eclipse.cdt.core.CCorePlugin; @@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IParameter; import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.internal.core.Util; import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants; @@ -60,8 +59,6 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter, IIndexFragment try { if(!(param instanceof IProblemBinding)) { IType type = param.getType(); - while(type instanceof ITypedef) - type = ((ITypedef)type).getType(); if (type != null) { PDOMNode typeNode = getLinkageImpl().addType(this, type); db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); 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 e17a818fc9e..acce9a2dd9b 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 @@ -157,6 +157,8 @@ public class CompletionTests extends AbstractContentAssistTest { // struct {int a3;} a4; // int b; // }; + // typedef enum {__nix} _e204758; + // void _f204758(_e204758 x); public CompletionTests(String name) { @@ -1166,4 +1168,10 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b", "s206450"}; assertCompletionResults(expected); } + + // void test() {_f204758/*cursor*/ + public void testTypedefToAnonymous_Bug204758() throws Exception { + final String[] expected= {"_f204758(_e204758 x) : void"}; + assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS); + } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java index 1212b88869d..324b31a2649 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests_PlainC.java @@ -10,7 +10,6 @@ * Markus Schorn (Wind River Systems) * IBM Corporation *******************************************************************************/ - package org.eclipse.cdt.ui.tests.text.contentassist2; import junit.framework.Test; @@ -142,6 +141,10 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest { // struct {int a3;} a4; // int b; // }; + // #ifdef bug204758 + // typedef enum {__nix} _e204758; + // void _f204758(_e204758 x); + // #endif //{DisturbWith.c} // int gTemp; @@ -951,4 +954,12 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest { final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b"}; assertCompletionResults(expected); } + + // #define bug204758 + ///*include*/ + // void test() {_f204758/*cursor*/ + public void testTypedefToAnonymous_Bug204758() throws Exception { + final String[] expected= {"_f204758(_e204758)"}; + assertCompletionResults(expected); + } }