diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 16 |
2 files changed, 18 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ae43baad92d..e5f6305faf7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2014-11-26 Ville Voutilainen <ville.voutilainen@gmail.com> + + Diagnose string constant conversion to char* in c++11 and above + as forbidden, not deprecated. + * typeck.c (string_conv_p): Do a pedwarn in c++11 and above, + change the diagnostic for the Wwrite-strings case for c++11 and above. + 2014-11-24 Jason Merrill <jason@redhat.com> * pt.c (lookup_template_variable): Always unknown_type_node. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index e100d70b1f2..8b66acc9011 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2139,12 +2139,18 @@ string_conv_p (const_tree totype, const_tree exp, int warn) || TREE_CODE (TREE_OPERAND (exp, 0)) != STRING_CST) return 0; } - - /* This warning is not very useful, as it complains about printf. */ if (warn) - warning (OPT_Wwrite_strings, - "deprecated conversion from string constant to %qT", - totype); + { + if (cxx_dialect >= cxx11) + pedwarn (input_location, + pedantic ? OPT_Wpedantic : OPT_Wwrite_strings, + "ISO C++ forbids converting a string constant to %qT", + totype); + else + warning (OPT_Wwrite_strings, + "deprecated conversion from string constant to %qT", + totype); + } return 1; } |