[clang] [clang][diagnostics] Fix fix-it hint parenthesis placement for fold expressions (PR #151790)
Iris Shi via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 2 00:18:13 PDT 2025
================
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -verify -std=c++17 -pedantic-errors %s
+// RUN: cp %s %t
+// RUN: not %clang_cc1 -x c++ -std=c++17 -fixit %t
+// RUN: %clang_cc1 -Wall -pedantic-errors -x c++ -std=c++17 %t
+
+/* This is a test of the various code modification hints that only
+ apply in C++17. */
+template<int... args>
+int foo() {
+ return (args + 1 + ...); // expected-error {{expression not permitted as operand of fold expression}}
----------------
el-ev wrote:
Thank you, the patch indeed did not work correctly for the long number. I've updated the code and included test cases for other kinds of fold expressions.
https://github.com/llvm/llvm-project/pull/151790
More information about the cfe-commits
mailing list