Skip to content
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

"in destructor name" bug #1097

Open
adetaylor opened this issue May 5, 2022 · 3 comments
Open

"in destructor name" bug #1097

adetaylor opened this issue May 5, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@adetaylor
Copy link
Collaborator

namespace rust {
inline namespace a {
class Str {
public:
  ~Str();
};
} // namespace a
} // namespace rust
@adetaylor adetaylor added the bug Something isn't working label May 5, 2022
adetaylor added a commit that referenced this issue May 18, 2022
@adetaylor
Copy link
Collaborator Author

The same problem appears when the test is:

#[test]
fn test_issue_1097() {
    let hdr = indoc! {"
        #include <cxx.h>
    "};
    run_generate_all_test(hdr);
}

so the minimization is plausible.

Somehow the known_types logic is causing us to generate arg0->~rust::Str();, because any other permutation of names gets the usual arg0->~StrA(); which is not buggy.

So, probably the correct solution is to just avoid generating any APIs for things in known_types even if we're in generate_all mode. Or something along those lines.

@adetaylor
Copy link
Collaborator Author

The problem reproduces with this alternative change and test case...

diff --git a/engine/src/known_types.rs b/engine/src/known_types.rs
index 3850db24..9379e2c4 100644
--- a/engine/src/known_types.rs
+++ b/engine/src/known_types.rs
@@ -413,6 +413,14 @@ fn create_type_database() -> TypeDatabase {
         true,
         false,
     ));
+    db.insert(TypeDetails::new(
+        "str",
+        "a::Fish",
+        Behavior::RustStr,
+        None,
+        true,
+        false,
+    ));
     db.insert(TypeDetails::new(
         "String",
         "rust::String",
diff --git a/integration-tests/tests/integration_test.rs b/integration-tests/tests/integration_test.rs
index 8aa41360..15134c5d 100644
--- a/integration-tests/tests/integration_test.rs
+++ b/integration-tests/tests/integration_test.rs
@@ -11423,6 +11423,27 @@ fn test_issue_1097() {
     run_generate_all_test(hdr);
 }
 
+#[test]
+fn test_issue_1097b() {
+    let hdr = indoc! {"
+        namespace a {
+        class Fish {
+        public:
+          ~Fish();
+        };
+        inline namespace b {
+        class Fish {
+        public:
+          ~Fish();
+        };
+        }
+        }
+    "};
+    run_generate_all_test(hdr);
+}
+
+#[test]
+
 #[test]
 fn test_issue_1098a() {
     let hdr = indoc! {"

@adetaylor
Copy link
Collaborator Author

The work in #1264 might help/change this a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant