Skip to content

Commit 4351c9c

Browse files
committed
Try to fix name mangling issues with GCC and static call operators
1 parent 3e3edea commit 4351c9c

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

tests/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ if(SQLITE_ORM_OMITS_CODECVT)
5555
target_compile_definitions(unit_tests PRIVATE SQLITE_ORM_OMITS_CODECVT=1)
5656
endif()
5757

58-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
59-
# GCC would complain about name mangling errors (with type traits for locally defined lambdas) if the ABI version is not set to 0
60-
add_compile_options(-fabi-version=0)
61-
elseif(MSVC)
58+
if(MSVC)
6259
target_compile_options(unit_tests PUBLIC
6360
# multi-processor compilation
6461
/MP

tests/static_tests/function_static_tests.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,29 +315,31 @@ TEST_CASE("function static") {
315315
}
316316
#endif
317317
};
318+
#ifdef SQLITE_ORM_STATIC_CALL_OPERATOR_SUPPORTED
319+
// note: this static lambda lives up here because of GCC 13.2 and mangling issues
320+
constexpr auto lambda_static_dummy = [](unsigned long errcode) static {
321+
return errcode != 0;
322+
};
323+
#endif
318324

319325
SECTION("detect overloaded call operator") {
320-
constexpr auto lambda = [](unsigned long errcode) {
321-
return errcode != 0;
322-
};
326+
constexpr auto lambda = [](unsigned long) {};
323327
using lambda_type = std::remove_const_t<decltype(lambda)>;
324328

325329
STATIC_REQUIRE(
326-
polyfill::is_detected_v<internal::overloaded_callop_t, bool(unsigned long) const, lambda_type>);
330+
polyfill::is_detected_v<internal::overloaded_callop_t, void(unsigned long) const, lambda_type>);
327331
STATIC_REQUIRE_FALSE(
328-
polyfill::is_detected_v<internal::overloaded_static_callop_t, bool(unsigned long) const, lambda_type>);
332+
polyfill::is_detected_v<internal::overloaded_static_callop_t, void(unsigned long) const, lambda_type>);
329333
}
330334
#ifdef SQLITE_ORM_STATIC_CALL_OPERATOR_SUPPORTED
331335
SECTION("detect overloaded static call operator") {
332-
constexpr auto lambda = [](unsigned long errcode) static {
333-
return errcode != 0;
334-
};
336+
constexpr auto lambda = [](unsigned long) static {};
335337
using lambda_type = std::remove_const_t<decltype(lambda)>;
336338

337339
STATIC_REQUIRE_FALSE(
338-
polyfill::is_detected_v<internal::overloaded_callop_t, bool(unsigned long), lambda_type>);
340+
polyfill::is_detected_v<internal::overloaded_callop_t, void(unsigned long), lambda_type>);
339341
STATIC_REQUIRE(
340-
polyfill::is_detected_v<internal::overloaded_static_callop_t, bool(unsigned long), lambda_type>);
342+
polyfill::is_detected_v<internal::overloaded_static_callop_t, void(unsigned long), lambda_type>);
341343
}
342344
#endif
343345
SECTION("freestanding function") {

tests/user_defined_functions.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,12 @@ TEST_CASE("generalized scalar udf") {
561561
}
562562
#endif
563563
};
564+
#ifdef SQLITE_ORM_STATIC_CALL_OPERATOR_SUPPORTED
565+
// note: this static lambda lives up here because of GCC 13.2 and mangling issues
566+
constexpr auto lambda_static_dummy = [](unsigned long errcode) static {
567+
return errcode != 0;
568+
};
569+
#endif
564570

565571
auto storage = make_storage("");
566572
storage.sync_schema();

0 commit comments

Comments
 (0)