Issue 151787
Summary [clang] Hints for `fold_expression_bad_operand` insert parentheses at incorrect location
Labels clang
Assignees el-ev
Reporter el-ev
    ```cpp
template<int... args>
int foo() {
    return (args + 1 + ...);
}

```

### Actual behaviour:
The right parenthesis is inserted before `1`
```
/tmp/test.cpp:3:18: error: _expression_ not permitted as operand
 of fold _expression_
    3 |     return (args + 1 + ...);
      | ~~~~~^~~
      |             (      )
1 error generated.

-->
return ((args + )1 + ...);
```

### Expected behaviour:
The right parenthesis should be inserted after `1`
```
/tmp/test.cpp:3:18: error: _expression_ not permitted as operand
      of fold _expression_
    3 |     return (args + 1 + ...);
      |             ~~~~~^~~
      |             (       )
1 error generated.

-->
return ((args + 1) + ...);
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to