Clang-tidy crashes when string reference used as parameter


The following causes clang-tidy to crash:



void func(std::string& s){s.c_str();}


clang-tidy test.cpp –

I am on Windows, using clang 8 built from trunk last week. Clang-tidy still crashes when changing c_str() to data(), but does not crash if the parameter used is instead std::string s. Clang-check does not crash at all and is able to produce the AST.



Hi Stuart,

i can reproduce the issue, but it is not within clang-tidy, directly but in the CSA. The following invocation is the only invocation that results in the segfault.

~/opt/llvm/build/bin/clang-tidy -checks=-*,clang-analyzer-cplusplus.InnerPointer clang-tidy-bug.cpp –

The bug is reported here:

Best, Jonas

Hi Jonas,

Thanks for this. You’re right, turning off the InnerPointer check eliminates the crash.