Skip to content

Commit 290bb46

Browse files
speak-agentclaude
andcommitted
test_workspace_inheritance: compare the #710 toolchain through its value
With clang 20.1.7 and the MSVC STL, `std::optional<std::string>("gcc@...")` failed to instantiate in this translation unit, which includes gtest's headers and imports std; the Windows unit-test job reported the only failure of its 129 tests as that compile error. The test now checks has_value() and compares the string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent af4c96f commit 290bb46

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎tests/unit/test_workspace_inheritance.cpp‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,22 @@ TEST(HostToolToolchain, AMemberToolReadsItsWorkspaceToolchain) {
236236
"[package]\nname = \"tool\"\nversion = \"0.1.0\"\n");
237237
auto tool = mcpp::manifest::load(root / "tool" / "mcpp.toml");
238238
ASSERT_TRUE(tool.has_value());
239-
EXPECT_EQ(mcpp::build::host_tool_declared_toolchain(*tool, root / "tool", "linux"),
240-
std::optional<std::string>("gcc@15.1.0"));
239+
// Compared through the value: with clang and the MSVC STL, constructing
240+
// std::optional<std::string> from a literal fails to instantiate in this
241+
// translation unit, which includes gtest's headers and imports std.
242+
auto tc15 = mcpp::build::host_tool_declared_toolchain(*tool, root / "tool", "linux");
243+
ASSERT_TRUE(tc15.has_value());
244+
EXPECT_EQ(*tc15, "gcc@15.1.0");
241245

242246
// The tool's own declaration wins over the workspace's.
243247
write(root / "tool" / "mcpp.toml",
244248
"[package]\nname = \"tool\"\nversion = \"0.1.0\"\n\n"
245249
"[toolchain]\ndefault = \"gcc@16.1.0\"\n");
246250
tool = mcpp::manifest::load(root / "tool" / "mcpp.toml");
247251
ASSERT_TRUE(tool.has_value());
248-
EXPECT_EQ(mcpp::build::host_tool_declared_toolchain(*tool, root / "tool", "linux"),
249-
std::optional<std::string>("gcc@16.1.0"));
252+
auto tc16 = mcpp::build::host_tool_declared_toolchain(*tool, root / "tool", "linux");
253+
ASSERT_TRUE(tc16.has_value());
254+
EXPECT_EQ(*tc16, "gcc@16.1.0");
250255

251256
std::error_code ec;
252257
fs::remove_all(root, ec);

0 commit comments

Comments
 (0)