mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 04:46:27 +08:00
String literals enclosed in parentheses are still string
literals. Fixes PR7488. llvm-svn: 106607
This commit is contained in:
@@ -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>()) {
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user