Index: include/clang/Basic/DiagnosticLexKinds.td =================================================================== --- include/clang/Basic/DiagnosticLexKinds.td +++ include/clang/Basic/DiagnosticLexKinds.td @@ -186,6 +186,8 @@ "hexadecimal floating literals are incompatible with " "C++ standards before C++1z">, InGroup, DefaultIgnore; +def warn_cxx1z_string_view_literal : Warning< + "string_view literals are a C++1z feature">, InGroup; def ext_binary_literal : Extension< "binary integer literals are a GNU extension">, InGroup; def ext_binary_literal_cxx14 : Extension< Index: lib/Lex/Lexer.cpp =================================================================== --- lib/Lex/Lexer.cpp +++ lib/Lex/Lexer.cpp @@ -1713,6 +1713,13 @@ getLangOpts()); if (!isIdentifierBody(Next)) { // End of suffix. Check whether this is on the whitelist. + if (Chars == 2 && Buffer[0] == 's' && Buffer[1] == 'v') { + IsUDSuffix = true; + if (!getLangOpts().CPlusPlus1z) + Diag(CurPtr, diag::warn_cxx1z_string_view_literal) + << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " "); + break; + } IsUDSuffix = (Chars == 1 && Buffer[0] == 's') || NumericLiteralParser::isValidUDSuffix( getLangOpts(), StringRef(Buffer, Chars));