diff --git a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp index f6e75cc2d3a0..3f18cd45e564 100644 --- a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp +++ b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp @@ -48,9 +48,9 @@ protected: // Example error handling. if (args[i] == "-an-error") { DiagnosticsEngine &D = CI.getDiagnostics(); - unsigned DiagID = D.getCustomDiagID( - DiagnosticsEngine::Error, "invalid argument '" + args[i] + "'"); - D.Report(DiagID); + unsigned DiagID = D.getCustomDiagID(DiagnosticsEngine::Error, + "invalid argument '%0'"); + D.Report(DiagID) << args[i]; return false; } }