Skip to content

Move C++ virtual destructor definition to .cpp files (#21529) #21530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pylaterreur
Copy link

@pylaterreur
Copy link
Author

pylaterreur commented Jul 8, 2025

Also, we probably want to look at why the destructors were/are not noexcept.

And there is an actual issue with the restbed cpp generator, it's creating classes inheriting from restbedcpp "Resource" which has a delete copy ctor, but these derived class define a default copy ctor, I'm not sure how that can work. The delete copy ctor in restbed cpp has been like this for 10 years. Are there enough tests for this?

@wing328
Copy link
Member

wing328 commented Jul 9, 2025

thanks for the pr

please follow step 3 in the pr checklist to update the samples

@pylaterreur
Copy link
Author

thanks for the pr

please follow step 3 in the pr checklist to update the samples

That's now done, in a 2nd commit in this PR.

There is 1 file I didn't commit, however, because I don't think this is due to any code changes of mine, it's a java generated file:

index 5062b4c48e..86be74c431 100644
--- a/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/model/Fruit.java
+++ b/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/model/Fruit.java
@@ -30,9 +30,7 @@ import javax.annotation.Generated;
 @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "fruitType", visible = true)
 @JsonSubTypes({
   @JsonSubTypes.Type(value = Apple.class, name = "APPLE"),
-  @JsonSubTypes.Type(value = Banana.class, name = "BANANA"),
-  @JsonSubTypes.Type(value = Apple.class, name = "Apple"),
-  @JsonSubTypes.Type(value = Banana.class, name = "Banana")
+  @JsonSubTypes.Type(value = Banana.class, name = "BANANA")
 })
 
 @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")```
 
My JAVA_HOME is set to be /usr/ as this is where "java" is installed on my machine
java --version
openjdk 11.0.27 2025-04-15
OpenJDK Runtime Environment (build 11.0.27+6-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.27+6-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants