diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-06-22 23:47:37 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-06-22 23:47:37 +0000 |
commit | 1984eb9a1522ad56e1310643a85f66b2b3424c91 (patch) | |
tree | c1440d2d7d28e2572d2a2e993840cb9c04b02d15 | |
parent | 169b753b4546b464ad81742ec09a9b9bb11d3b47 (diff) |
String literals enclosed in parentheses are still string
literals. Fixes PR7488.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106607 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/overload-call.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 0e61f1d23a..3220494cbc 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1540,7 +1540,7 @@ Sema::IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType) { // be converted to an rvalue of type "pointer to char"; a wide // string literal can be converted to an rvalue of type "pointer // to wchar_t" (C++ 4.2p2). - if (StringLiteral *StrLit = dyn_cast<StringLiteral>(From)) + if (StringLiteral *StrLit = dyn_cast<StringLiteral>(From->IgnoreParens())) if (const PointerType *ToPtrType = ToType->getAs<PointerType>()) if (const BuiltinType *ToPointeeType = ToPtrType->getPointeeType()->getAs<BuiltinType>()) { diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 9df5bc9f0c..37974ef929 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -54,6 +54,7 @@ double* k(bool); void test_k() { int* ip1 = k("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}} + int* ip2 = k(("foo")); // expected-warning{{conversion from string literal to 'char *' is deprecated}} double* dp1 = k(L"foo"); } |