Issue 157734
Summary false positive cppcoreguidelines-prefer-member-initializer warning, applying tweak produces broken code
Labels false-positive
Assignees
Reporter geza-herman
    See this example:

```c++
struct Base {
    int a = 0;
};

template <typename T>
struct Der: Base {
    Der() {
        a = 1;
 }
};
```

clang-tidy produces `cppcoreguidelines-prefer-member-initializer` warning for `a = 1` in `Der`. Applying the suggested tweak (puts `a(1)` into `Der`'s member initializer list) creates broken code.

If `Der` is not a template, this problem doesn't happen.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to