[cfe-commits] r106607 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/overload-call.cpp
Douglas Gregor
dgregor at apple.com
Tue Jun 22 16:47:37 PDT 2010
Author: dgregor
Date: Tue Jun 22 18:47:37 2010
New Revision: 106607
URL: http://llvm.org/viewvc/llvm-project?rev=106607&view=rev
Log:
String literals enclosed in parentheses are still string
literals. Fixes PR7488.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/overload-call.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=106607&r1=106606&r2=106607&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Jun 22 18:47:37 2010
@@ -1540,7 +1540,7 @@
// 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>()) {
Modified: cfe/trunk/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=106607&r1=106606&r2=106607&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call.cpp Tue Jun 22 18:47:37 2010
@@ -54,6 +54,7 @@
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");
}
More information about the cfe-commits
mailing list