add fix to prevent GCC compilation crashing
This commit is contained in:
@@ -6,9 +6,15 @@ set(CMAKE_CXX_STANDARD 23)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# define explicitely GCC version to prevent redefintion by CLANG
|
# define explicitely GCC version to prevent redefintion by CLANG
|
||||||
# if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# add_compile_options(-fgnuc-version=${CMAKE_CXX_COMPILER_VERSION})
|
# add_compile_options(-fgnuc-version=${CMAKE_CXX_COMPILER_VERSION})
|
||||||
# endif()
|
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||||
|
list(GET VERSION_LIST 0 VER_MAJOR)
|
||||||
|
list(GET VERSION_LIST 1 VER_MINOR)
|
||||||
|
list(GET VERSION_LIST 2 VER_PATCH)
|
||||||
|
math(EXPR GCC_VER "${VER_MAJOR}*10000+${VER_MINOR}*100+${VER_PATCH}")
|
||||||
|
add_compile_definitions("GCC_VERSION=${GCC_VER}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# for ccls
|
# for ccls
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|||||||
@@ -450,18 +450,26 @@ public:
|
|||||||
std::error_code ec{};
|
std::error_code ec{};
|
||||||
std::string output_buffer;
|
std::string output_buffer;
|
||||||
|
|
||||||
// #ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
// #if __GNUG__ < 16
|
// to fix GCC compilation crash for the versions < 16
|
||||||
// auto write_rec = [&output_buffer, &ec, obj_ptr = this]<size_t I = 0>(this auto& self) -> void {
|
#if GCC_VERSION < 160000
|
||||||
// #else
|
auto write_rec = [&output_buffer, &ec, obj_ptr = this]<size_t I = 0>(this auto& self) -> void {
|
||||||
|
#else
|
||||||
auto write_rec = [&output_buffer, &ec, this]<size_t I = 0>(this auto& self) -> void {
|
auto write_rec = [&output_buffer, &ec, this]<size_t I = 0>(this auto& self) -> void {
|
||||||
// #endif
|
#endif
|
||||||
// #endif
|
#endif
|
||||||
if constexpr (I < NUMBER_OF_RECORDS) {
|
if constexpr (I < NUMBER_OF_RECORDS) {
|
||||||
// add an empty string within records
|
// add an empty string within records
|
||||||
std::format_to(std::back_inserter(output_buffer), "{}", DEFAULT_RECORD_DELIMITER);
|
std::format_to(std::back_inserter(output_buffer), "{}", DEFAULT_RECORD_DELIMITER);
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// to fix GCC compilation crash for the versions < 16
|
||||||
|
#if GCC_VERSION < 160000
|
||||||
|
ec = obj_ptr->template formatRecord<I>(output_buffer, DEFAULT_RECORD_DELIMITER, true);
|
||||||
|
#else
|
||||||
ec = formatRecord<I>(output_buffer, DEFAULT_RECORD_DELIMITER, true);
|
ec = formatRecord<I>(output_buffer, DEFAULT_RECORD_DELIMITER, true);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
if (ec) {
|
if (ec) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user