diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index ff1f4eef230..ef945c40951 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -13,6 +13,7 @@ * Sergey Prigogin (Google) * Thomas Corbat (IFS) * Nathan Ridge + * Marc-Andre Laperle *******************************************************************************/ package org.eclipse.cdt.core.parser.tests.ast2; @@ -7481,6 +7482,14 @@ public class AST2CPPTests extends AST2TestBase { BindingAssertionHelper ba= getAssertionHelper(); ba.assertProblem("enum_name", 9); } + + // struct MyStruct { + // enum MyEnum {}; + // MyStruct(MyEnum value) {} + // }; + public void testEnumRedefinitionInStruct_385144() throws Exception { + parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); + } // class CL { // typedef int x; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java index 8afc1bf3d89..f5762cf74ef 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2012 IBM Corporation and others. + * Copyright (c) 2004, 2013 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 @@ -12,6 +12,7 @@ * Sergey Prigogin (Google) * Thomas Corbat (IFS) * Nathan Ridge + * Marc-Andre Laperle *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; @@ -405,6 +406,9 @@ public class CPPVisitor extends ASTQueries { IBinding binding = scope.getBinding(name, false); if (binding instanceof CPPEnumeration) { CPPEnumeration e= (CPPEnumeration) binding; + if (name.equals(e.getDefinition())) { + return e; + } if (e.isScoped() == specifier.isScoped()) { IType ft2= e.getFixedType(); if (fixedType == ft2 || (fixedType != null && fixedType.isSameType(ft2))) {