JonasToth added a comment. In D54943#1815358 <https://reviews.llvm.org/D54943#1815358>, @0x8000-0000 wrote:
> Here is a minimal example that shows the problem: > > #include <memory> > > template<typename SomeValue> > struct DoGooder > { > DoGooder(void* accessor, SomeValue value) > { > } > > }; > > struct Bingus > { > static constexpr auto someRandomConstant = 99; > }; > > template<typename Foo> > struct HardWorker > { > HardWorker() > { > const DoGooder anInstanceOf{nullptr, Foo::someRandomConstant}; > } > }; > > struct TheContainer > { > std::unique_ptr<HardWorker<Bingus>> m_theOtherInstance; > }; > > > Example run: > > $ /opt/clang10/bin/clang-tidy > -checks="-*,cppcoreguidelines-const-correctness" -header-filter=".*" > reproconst.cpp -- -std=c++17 -Wall > 54 warnings generated. > reproconst.cpp:22:9: warning: variable 'anInstanceOf' of type '<dependent > type>' can be declared 'const' [cppcoreguidelines-const-correctness] > const DoGooder anInstanceOf{nullptr, Foo::someRandomConstant}; > ^ > const > Suppressed 53 warnings (53 in non-user code). > Use -header-filter=.* to display errors from all non-system headers. Use > -system-headers to display errors from system headers as well. > I can not reproduce that case :( It gives me a compilation error in `const DoGooder anInstanceOf...`, because `DoGooder` requires an template parameter. I then add `DoGooder<int>` and the variable gets no transformation. Did you reproduce the error with exactly that code? And which version did you run? Maybe that was a previous false positive, that might be fixed right now? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54943/new/ https://reviews.llvm.org/D54943 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits