https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123737
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:e2f626b37ef62fcab8667b2a67318c27a8f2a6ca commit r16-7013-ge2f626b37ef62fcab8667b2a67318c27a8f2a6ca Author: Jakub Jelinek <[email protected]> Date: Sat Jan 24 10:38:17 2026 +0100 c++: Fix wrong-code with overloaded comma and CPP_EMBED [PR123737] In cp_parser_expression for comma operator I've used a short path where instead of calling build_x_compound_expr #embed number times it is called just 3 times, for the CPP_NUMBER added by the preprocessor at the start, last byte from CPP_EMBED and then CPP_NUMBER added by libcpp at the end, enough to make sure -Wunused-value reports something, but not bothering users with millions of -Wunused-value warnings and spending too much compile time on it when they use a very large #embed. As the following testcases show, that is ok for C or for C++ if the expression before it is known not to have OVERLOAD_TYPE_P (common case is INTEGER_TYPE I guess), but doesn't work well in case one uses overloaded comma operator. In that case we just have to call build_x_compound_expr the right number of times, even if it is a lot. I think I don't need to test for !expression, because the preprocessor should guarantee that CPP_EMBED is preceded by CPP_NUMBER CPP_COMMA tokens. 2026-01-24 Jakub Jelinek <[email protected]> PR c++/123737 * parser.cc (cp_parser_expression): Don't handle CPP_EMBED just as the last byte in it if expression has or might have overloaded type. In that case call build_x_compound_expr for each byte in CPP_EMBED separately. * g++.dg/cpp/embed-28.C: New test. * g++.dg/parse/comma3.C: New test.
