From bd4fb758ad6c222a6586c9bb43b650c50f669cbc Mon Sep 17 00:00:00 2001 From: Bertrand Bellenot Date: Fri, 7 Nov 2025 14:34:00 +0100 Subject: [PATCH 1/2] [io] Fix std::complex on Windows Fixes https://github.com/root-project/root/issues/20312 --- core/clingutils/src/complexLinkdef.h | 11 +++++++++++ roottest/root/io/newstl/ComplexTest_win32.ref | 2 -- roottest/root/io/newstl/ComplexTest_win64.ref | 2 -- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/clingutils/src/complexLinkdef.h b/core/clingutils/src/complexLinkdef.h index 855a5824199d9..b7d78993fa25b 100644 --- a/core/clingutils/src/complexLinkdef.h +++ b/core/clingutils/src/complexLinkdef.h @@ -3,6 +3,17 @@ #pragma extra_include "root_std_complex.h"; +#ifdef _WIN32 +#pragma create TClass _C_float_complex+; +#pragma create TClass _Complex_base+; +#pragma create TClass _C_double_complex+; +#pragma create TClass _Complex_base+; +#pragma create TClass _Complex_value+; +#pragma create TClass _Complex_value+; +#pragma create TClass _Complex_base>+; +#pragma create TClass _Complex_base>+; +#endif + #pragma create TClass complex+; #pragma create TClass complex+; #pragma create TClass complex+; diff --git a/roottest/root/io/newstl/ComplexTest_win32.ref b/roottest/root/io/newstl/ComplexTest_win32.ref index da4dad5a07dcf..4e79efb526872 100644 --- a/roottest/root/io/newstl/ComplexTest_win32.ref +++ b/roottest/root/io/newstl/ComplexTest_win32.ref @@ -1,7 +1,5 @@ Processing runComplexTest.C... -Warning in : _Complex_base: base class _C_double_complex has no streamer or dictionary it will not be saved -Warning in : complex: base class _Complex_base has no streamer or dictionary it will not be saved The complex object was set properly: 3 6 The complex object was read properly: diff --git a/roottest/root/io/newstl/ComplexTest_win64.ref b/roottest/root/io/newstl/ComplexTest_win64.ref index da4dad5a07dcf..4e79efb526872 100644 --- a/roottest/root/io/newstl/ComplexTest_win64.ref +++ b/roottest/root/io/newstl/ComplexTest_win64.ref @@ -1,7 +1,5 @@ Processing runComplexTest.C... -Warning in : _Complex_base: base class _C_double_complex has no streamer or dictionary it will not be saved -Warning in : complex: base class _Complex_base has no streamer or dictionary it will not be saved The complex object was set properly: 3 6 The complex object was read properly: From d7372e1f78f58bb6d03fc35e7395a3d34c87bdda Mon Sep 17 00:00:00 2001 From: Bertrand Bellenot Date: Fri, 7 Nov 2025 15:04:33 +0100 Subject: [PATCH 2/2] Remove windows specific #pragmas and ref files --- roottest/root/io/newstl/CMakeLists.txt | 2 +- roottest/root/io/newstl/ComplexTest.h | 5 ----- roottest/root/io/newstl/ComplexTest_win32.ref | 6 ------ roottest/root/io/newstl/ComplexTest_win64.ref | 6 ------ 4 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 roottest/root/io/newstl/ComplexTest_win32.ref delete mode 100644 roottest/root/io/newstl/ComplexTest_win64.ref diff --git a/roottest/root/io/newstl/CMakeLists.txt b/roottest/root/io/newstl/CMakeLists.txt index 7b95839fb5086..9fb01172db3a5 100644 --- a/roottest/root/io/newstl/CMakeLists.txt +++ b/roottest/root/io/newstl/CMakeLists.txt @@ -52,7 +52,7 @@ endif() ROOTTEST_ADD_TEST(ComplexTest MACRO runComplexTest.C ROOTEXE_OPTS ${_complextest_load} - OUTREF ComplexTest${ref_suffix} + OUTREF ComplexTest.ref FIXTURES_REQUIRED root-io-newstl-ComplexTest_h-fixture) ROOTTEST_ADD_TEST(SampleFile diff --git a/roottest/root/io/newstl/ComplexTest.h b/roottest/root/io/newstl/ComplexTest.h index d853262680aa0..3b012c8823083 100644 --- a/roottest/root/io/newstl/ComplexTest.h +++ b/roottest/root/io/newstl/ComplexTest.h @@ -24,9 +24,4 @@ class Test: public TObject ClassDefOverride(Test, 1); }; -#ifdef __ROOTCLING__ -#pragma link C++ class std::complex+; -#pragma link C++ class Test+; -#endif - #endif /* Test_hh */ diff --git a/roottest/root/io/newstl/ComplexTest_win32.ref b/roottest/root/io/newstl/ComplexTest_win32.ref deleted file mode 100644 index 4e79efb526872..0000000000000 --- a/roottest/root/io/newstl/ComplexTest_win32.ref +++ /dev/null @@ -1,6 +0,0 @@ - -Processing runComplexTest.C... -The complex object was set properly: -3 6 -The complex object was read properly: -3 6 diff --git a/roottest/root/io/newstl/ComplexTest_win64.ref b/roottest/root/io/newstl/ComplexTest_win64.ref deleted file mode 100644 index 4e79efb526872..0000000000000 --- a/roottest/root/io/newstl/ComplexTest_win64.ref +++ /dev/null @@ -1,6 +0,0 @@ - -Processing runComplexTest.C... -The complex object was set properly: -3 6 -The complex object was read properly: -3 6