mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
Bug 376246: Name resolution in catch handler of function definition.
This commit is contained in:
parent
ba5775f033
commit
755d3975a6
2 changed files with 14 additions and 6 deletions
|
@ -9592,4 +9592,12 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertSame(calls[calls.length - 1] + " and " + calls[calls.length - 2] + " resolve to different functions",
|
||||
functions[calls.length - 1], functions[calls.length - 2]);
|
||||
}
|
||||
|
||||
// void f(int x) try {
|
||||
// } catch(...) {
|
||||
// (void)x;
|
||||
// }
|
||||
public void testParentScopeOfCatchHandler_376246() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
||||
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -1264,7 +1260,11 @@ public class CPPVisitor extends ASTQueries {
|
|||
} else if (parent instanceof IASTStatement) {
|
||||
scope = getContainingScope((IASTStatement) parent);
|
||||
} else if (parent instanceof IASTFunctionDefinition) {
|
||||
IASTFunctionDeclarator fnDeclarator = ((IASTFunctionDefinition) parent).getDeclarator();
|
||||
final IASTFunctionDefinition fdef = (IASTFunctionDefinition) parent;
|
||||
if (statement instanceof ICPPASTCatchHandler)
|
||||
return fdef.getScope();
|
||||
|
||||
IASTFunctionDeclarator fnDeclarator = fdef.getDeclarator();
|
||||
IASTName name = findInnermostDeclarator(fnDeclarator).getName();
|
||||
if (name instanceof ICPPASTQualifiedName) {
|
||||
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
||||
|
|
Loading…
Add table
Reference in a new issue