Skip to content

Commit

Permalink
Don't set context.virtualize for constructors.
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Dec 30, 2023
1 parent 9623631 commit 514aeb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2512,7 +2512,12 @@ boolean function(Context context, DeclarationList declList) throws ParserExcepti

type = functionAfter(context, decl, dcl, type);
context = new Context(context);
context.virtualize = (context.virtualize && type.virtual) || (info != null && info.virtualize);

// Virtualize the function if class is virtualized and C++ function is virtual
// or if function is explicitly virtualized with info.
// Exclude constructor case since we may have looked up the info of the class in lieu of
// the info of the constructor, and constructors cannot be virtualized.
context.virtualize = (context.virtualize && type.virtual) || (info != null && info.virtualize && !type.constructor);

List<Declarator> prevDcl = new ArrayList<Declarator>();
boolean first = true;
Expand Down

0 comments on commit 514aeb9

Please sign in to comment.