From cb16073c3c9f18cbeebe2f6b8b2e4dae775c1f42 Mon Sep 17 00:00:00 2001 From: Eric Veilleux Date: Mon, 6 Feb 2023 15:17:31 -0500 Subject: [PATCH] Add test for issue #1229 --- integration-tests/tests/integration_test.rs | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/integration-tests/tests/integration_test.rs b/integration-tests/tests/integration_test.rs index af1d380de..46f2594f9 100644 --- a/integration-tests/tests/integration_test.rs +++ b/integration-tests/tests/integration_test.rs @@ -11827,6 +11827,47 @@ fn test_issue_1214() { run_test("", hdr, quote! {}, &["C"], &[]); } +#[test] +fn test_issue_1229() { + let hdr = indoc! {" + struct Thing { + float id; + + Thing(float id) : id(id) {} + }; + + struct Item { + float id; + + Item(float id) : id(id) {} + }; + "}; + let hexathorpe = Token![#](Span::call_site()); + let rs = quote! { + use autocxx::WithinUniquePtr; + + autocxx::include_cpp! { + #hexathorpe include "input.h" + name!(thing) + safety!(unsafe) + generate!("Thing") + } + autocxx::include_cpp! { + #hexathorpe include "input.h" + name!(item) + safety!(unsafe) + generate!("Item") + } + + fn main() { + let thing = thing::Thing::new(15.).within_unique_ptr(); + let item = item::Item::new(15.).within_unique_ptr(); + } + }; + + do_run_test_manual("", hdr, rs, None, None).unwrap(); +} + // Yet to test: // - Ifdef // - Out param pointers