diff --git a/CHANGELOG.md b/CHANGELOG.md index 04576d035..b5fd56348 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ + * Fix `Parser` on function pointer declarations starting with `typedef struct` ([pull bytedeco/javacpp-presets#1361](https://github.com/bytedeco/javacpp-presets/pull/1361)) + ### June 6, 2023 version 1.5.9 * Fix `Loader.extractResource()` for nested JAR files from Spring Boot ([pull #685](https://github.com/bytedeco/javacpp/pull/685)) * Have `Parser` desugar `...` varargs to array `[]` for return types as well ([pull #682](https://github.com/bytedeco/javacpp/pull/682)) diff --git a/src/main/java/org/bytedeco/javacpp/tools/Parser.java b/src/main/java/org/bytedeco/javacpp/tools/Parser.java index 77fca4e03..7f6125cf0 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/Parser.java +++ b/src/main/java/org/bytedeco/javacpp/tools/Parser.java @@ -3396,6 +3396,11 @@ boolean group(Context context, DeclarationList declList) throws ParserException } } } + if (typedef && tokens.get().match('(')) { + // this is probably a function pointer declaration + tokens.index = backIndex; + return false; + } if (typedef && type.indirections > 0) { // skip pointer typedef while (!tokens.get().match(';', Token.EOF)) {