File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,15 @@ struct unnamed_ns_type_mock {};
23
23
struct unnamed_ns_mock_caster {
24
24
static int num () { return 303 ; }
25
25
};
26
- #if defined(__GNUC__)
27
- # pragma GCC diagnostic push
28
- # pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
29
- #endif
30
26
unnamed_ns_mock_caster pybind11_select_caster (unnamed_ns_type_mock *);
31
- #if defined(__GNUC__)
32
- # pragma GCC diagnostic pop
27
+ #if !defined(_MSC_VER)
28
+ // Dummy implementation, purely to avoid compiler warnings (unused function).
29
+ // Easier than managing compiler-specific pragmas for warning suppression.
30
+ // MSVC happens to not generate any warnings. Leveraging that to prove that
31
+ // this test actually works without an implementation.
32
+ unnamed_ns_mock_caster pybind11_select_caster (unnamed_ns_type_mock *) {
33
+ return unnamed_ns_mock_caster{};
34
+ }
33
35
#endif
34
36
} // namespace
35
37
@@ -79,4 +81,9 @@ TEST_SUBMODULE(make_caster_adl, m) {
79
81
return obj;
80
82
});
81
83
m.def (" mrc_arg" , [](mrc_ns::type_mrc const &obj) { return obj.value + 2000 ; });
84
+
85
+ #if !defined(_MSC_VER)
86
+ // Dummy call, purely to avoid compiler warnings (unused function).
87
+ (void ) pybind11_select_caster (static_cast <unnamed_ns_type_mock *>(nullptr ));
88
+ #endif
82
89
}
You can’t perform that action at this time.
0 commit comments