You mean the ternary conditional operator?

I see no comma.
 

-----Ursprüngliche Nachricht-----
Von: Simon W via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Mi 21.05.2025 10:12
Betreff: [std-proposals] Hope that std::optional and comma expressions can work this way
An: std-proposals@lists.isocpp.org;
CC: Simon W <inte2012@gmail.com>;
 
The comma expression requires that the expressions on both sides of the colon are of the same type.  But I think this syntax should be accepted:

bool AllInUniversial();

std::optional<int> r = AllInUniversial() ? 42 : std::nullopt;
-- 
 Std-Proposals mailing list
 Std-Proposals@lists.isocpp.org
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals