From 069a6da34a86c97ffe78c379da246fc8116daaff Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 14 Mar 2011 16:13:32 +0000 Subject: [PATCH] -fwritable-strings should silence warnings about the deprecated string -literal to char* conversion. Make it so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127586 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExprCXX.cpp | 3 ++- test/SemaCXX/writable-strings-deprecated.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index ea93449d7b..5701835c1a 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -2273,7 +2273,8 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, ImpCastExprToType(From, ToType.getNonLValueExprType(Context), CK_NoOp, VK); - if (SCS.DeprecatedStringLiteralToCharPtr) + if (SCS.DeprecatedStringLiteralToCharPtr && + !getLangOptions().WritableStrings) Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion) << ToType.getNonReferenceType(); diff --git a/test/SemaCXX/writable-strings-deprecated.cpp b/test/SemaCXX/writable-strings-deprecated.cpp index c89c882564..66b5994798 100644 --- a/test/SemaCXX/writable-strings-deprecated.cpp +++ b/test/SemaCXX/writable-strings-deprecated.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s +// RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s // rdar://8827606 char *fun(void) -- 2.40.0