Index: clang-tidy/boost/UseToStringCheck.cpp =================================================================== --- clang-tidy/boost/UseToStringCheck.cpp +++ clang-tidy/boost/UseToStringCheck.cpp @@ -64,7 +64,7 @@ Diag << FixItHint::CreateReplacement( CharSourceRange::getCharRange(Call->getLocStart(), - Call->getArg(0)->getExprLoc()), + Call->getArg(0)->getLocStart()), (llvm::Twine("std::to_") + StringType + "(").str()); } Index: test/clang-tidy/boost-use-to-string.cpp =================================================================== --- test/clang-tidy/boost-use-to-string.cpp +++ test/clang-tidy/boost-use-to-string.cpp @@ -147,3 +147,23 @@ string_as_T(); string_as_T(); } + +struct Fields { + int integer; + float floating; + Fields* wierd; + const int &getConstInteger() const {return integer;} +}; + +void testFields() { + Fields fields; + auto s1 = boost::lexical_cast(fields.integer); + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::to_string{{..}} + // CHECK-FIXES: std::to_string(fields.integer); + + auto s2 = boost::lexical_cast(fields.floating); + auto s3 = boost::lexical_cast(fields.wierd); + auto s4 = boost::lexical_cast(fields.getConstInteger()); + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::to_string{{..}} + // CHECK-FIXES: std::to_string(fields.getConstInteger()); +}