Skip to content

Commit 3d37bb6

Browse files
committed
Disable module import test due to compiler stdlib issues
The test for direct 'import' statements in regular .cpp files is currently disabled because GCC 15 and Clang 18 standard library modules expose TU-local entities, causing compilation failures. This is a known upstream issue, not specific to podio. The test file and infrastructure remain in place as documentation of the intended usage pattern when compiler support matures. It will be re-enabled once standard library modules are stable.
1 parent 6a68383 commit 3d37bb6

2 files changed

Lines changed: 42 additions & 29 deletions

File tree

tests/unittests/CMakeLists.txt

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,43 @@ if(PODIO_ENABLE_CXX_MODULES)
4949
# This test demonstrates the intended usage pattern when CMake support matures.
5050
# CMake 3.28+ added CXX_MODULE file sets, but consuming them in regular .cpp files
5151
# requires dependency scanning to work correctly, which is still evolving.
52+
#
53+
# KNOWN ISSUES (as of GCC 15 / CMake 3.31):
54+
# - Standard library modules expose TU-local entities, causing compilation errors
55+
# - Module dependency scanning doesn't fully work with imported modules in .cpp files
56+
# - This test will fail to compile until these issues are resolved upstream
5257
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
53-
message(STATUS "CMake ${CMAKE_VERSION} - adding module import demonstration test")
54-
message(STATUS " Note: Direct 'import' in .cpp files requires experimental CMake features")
55-
message(STATUS " This test documents the intended usage when CMake module support matures")
58+
message(STATUS "CMake ${CMAKE_VERSION} - module import test available but expected to fail")
59+
message(STATUS " Note: Direct 'import' in .cpp files blocked by compiler/stdlib issues")
60+
message(STATUS " This test will be enabled once GCC/Clang stdlib modules are stable")
5661

5762
# This test serves as:
58-
# 1. Documentation of how modules SHOULD be consumed when CMake support is complete
59-
# 2. A canary to detect when CMake module support reaches maturity
63+
# 1. Documentation of how modules SHOULD be consumed when support is complete
64+
# 2. A canary to detect when module support reaches maturity
6065
# 3. Validation that our module interfaces are correctly structured
61-
add_executable(unittest_podio_import cxx_modules_import.cpp)
62-
target_link_libraries(unittest_podio_import PRIVATE
63-
TestDataModel
64-
podio::podio
65-
Catch2::Catch2WithMain
66-
)
67-
target_compile_features(unittest_podio_import PRIVATE cxx_std_20)
68-
69-
# Add the test but mark it as experimental
70-
add_test(NAME unittest_import COMMAND unittest_podio_import)
71-
PODIO_SET_TEST_ENV(unittest_import)
72-
set_tests_properties(unittest_import PROPERTIES
73-
LABELS "modules;import;experimental"
74-
# This test is expected to fail until CMake module dependency scanning matures
75-
# When it starts passing without code changes, CMake support has improved!
76-
WILL_FAIL TRUE
77-
)
66+
#
67+
# Currently disabled due to known compiler/stdlib issues
68+
# Uncomment when GCC/Clang provide stable standard library module support
69+
#
70+
# add_executable(unittest_podio_import cxx_modules_import.cpp)
71+
# target_link_libraries(unittest_podio_import PRIVATE
72+
# TestDataModel
73+
# podio::podio
74+
# Catch2::Catch2WithMain
75+
# )
76+
# target_compile_features(unittest_podio_import PRIVATE cxx_std_20)
77+
#
78+
# # Enable module scanning for this file
79+
# set_source_files_properties(cxx_modules_import.cpp PROPERTIES
80+
# LANGUAGE CXX
81+
# CXX_SCAN_FOR_MODULES ON
82+
# )
83+
#
84+
# add_test(NAME unittest_import COMMAND unittest_podio_import)
85+
# PODIO_SET_TEST_ENV(unittest_import)
86+
# set_tests_properties(unittest_import PROPERTIES
87+
# LABELS "modules;import;experimental"
88+
# )
7889
else()
7990
message(STATUS "CMake ${CMAKE_VERSION} - skipping module import test (requires 3.30+)")
8091
endif()

tests/unittests/cxx_modules_import.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
// - Ninja or VS generator (Unix Makefiles doesn't support modules)
88
// - GCC 14+ or Clang 18+ with -fmodules-ts support
99
//
10-
// STATUS: As of CMake 3.31, consuming modules via 'import' in regular .cpp files
11-
// works when dependency scanning correctly identifies the module dependencies.
12-
// This requires proper build system configuration and may still have edge cases.
10+
// CURRENT STATUS (Dec 2024):
11+
// This test is DISABLED due to known issues with GCC 15 and Clang 18:
12+
// - Standard library modules expose TU-local entities causing compilation errors
13+
// - Module dependency scanning in CMake 3.31 doesn't fully handle std imports
14+
// - These are upstream compiler/stdlib issues, not podio-specific
1315
//
14-
// The goal of this test is to demonstrate the INTENDED usage pattern when
15-
// CMake module support becomes fully mature. For now, using traditional headers
16-
// alongside generated modules (as demonstrated in cxx_modules_import.cpp) is
17-
// the recommended approach.
16+
// FUTURE: This test demonstrates the INTENDED usage pattern when C++20 module
17+
// support matures. It will be enabled once compilers provide stable standard
18+
// library modules without TU-local entity issues. Until then, use traditional
19+
// headers alongside generated modules for maximum compatibility.
1820

1921
import podio.core;
2022
import datamodel.datamodel;

0 commit comments

Comments
 (0)