Issue 99860
Summary [clang-tidy] false negative for misc-const-correctness in function-try-block
Labels clang-tidy
Assignees
Reporter schenker
    The check `misc-const-correctness` of clang-tidy 19.0.0git (20d38158ffbe1e01b74e39d36d4b3bc5e7a63d66) does not work as expected for function-try-blocks.


For thee following function the warning warning `variable 'i' of type 'int' can be declared 'const' [misc-const-correctness]` is generated.
```
int tp() {
  try {
 int i = 0;
    return i;
  } catch (...) {
    return 0;
 }
}
```
When the outer curly braces are ommited, the check does not report a warning.
```
int fn() try {
  int i = 0;
  return i;
} catch (...) {
  return 0;
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to