[LLVMbugs] [Bug 14528] New: constexpr literal string gets warning about deprecated string conversions
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Dec 6 13:12:10 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14528
Bug #: 14528
Summary: constexpr literal string gets warning about deprecated
string conversions
Product: clang
Version: unspecified
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: cliffy+llvm.bugs at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
A definition that looks like:
constexpr char *text = "...";
causes the deprecated-writable-strings warning:
cstring.cpp:32:35: warning: conversion from string literal to 'char *const'
is deprecated
[-Wdeprecated-writable-strings]
The workaround is to say both constexpr and const:
constexpr const char *text = "...";
Section 7.1.5 of the standard, paragraph 9 says: "A constexpr specifier used in
an object declaration declares the object as const." So I think that
"constexpr" should suffice in this case.
If it's any consolation, GCC 4.7.2 gives a similar warning.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list