diff options
author | Martin Boehme <mboehme@google.com> | 2021-04-29 09:10:31 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2021-04-30 11:02:20 +0200 |
commit | 910d2be897bacd41a683c4055bc0fbae1b088dbc (patch) | |
tree | 38e966e903dad4d9c484103064bc58a62915f680 /tests/headers | |
parent | f26d57d8f7febe2f7d62f39f7d9f2cbda8067bd2 (diff) |
Don't generate bindings for deleted member functions. (#2044)
Closes #2044
Fixes #2043
See https://github.com/rust-lang/rust-bindgen/issues/2043 for details.
Diffstat (limited to 'tests/headers')
-rw-r--r-- | tests/headers/deleted-function.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/headers/deleted-function.hpp b/tests/headers/deleted-function.hpp new file mode 100644 index 00000000..61848a0a --- /dev/null +++ b/tests/headers/deleted-function.hpp @@ -0,0 +1,35 @@ +// bindgen-flags: --generate-inline-functions -- -std=c++11 + +class A { +public: + // Deleted function should not get a binding. + void deleted() = delete; + + // Inline functions should get bindings, whether they are defined inline + // (in the class) or out of line. + inline void inline_definition() {} + inline void out_of_line_definition(); + + // TODO: This is an edge case that we get wrong: An inline function + // without a definition in the same translation unit should still get a + // binding. We currently can't distinguish this case from a deleted member + // function because libclang doesn't provide a direct way to query for + // deleted member functions. This seems acceptable, however, as an inline + // function without a definition in the same translation unit is unlikely + // to be useful in practice. + inline void inline_without_definition(); +}; + +void A::out_of_line_definition() {} + +class B { +public: + // Deleted copy constructor should not get a binding. + B(B&) = delete; +}; + +class C { +public: + // Defaulted copy constructor should get a binding. + C(C&) = default; +};
\ No newline at end of file |