diff --git a/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java b/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java index 28a6a88b9..6bfa81c09 100644 --- a/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java +++ b/languages/cpp/src/main/java/de/jplag/cpp/CPPListener.java @@ -207,7 +207,7 @@ private void declarationRules() { visit(ParameterDeclarationContext.class).map(VARDEF).withSemantics(CodeSemantics::new).onEnter((ctx, varReg) -> { // don't register parameters in function declarations, e.g. bc6h_enc lines 117-120 - if (hasAncestor(ctx, FunctionDefinitionContext.class, SimpleDeclarationContext.class)) { + if (hasAncestor(ctx, FunctionDefinitionContext.class, SimpleDeclarationContext.class) && ctx.declarator() != null) { CPP14Parser.PointerDeclaratorContext pd = ctx.declarator().pointerDeclarator(); String name = pd.noPointerDeclarator().getText(); varReg.registerVariable(name, VariableScope.LOCAL, true);