aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1998-08-23 22:08:45 -0400
committerJason Merrill <jason@gcc.gnu.org>1998-08-23 22:08:45 -0400
commitd9cf7c824593edf5fba4c00f41eaa1e791855c3e (patch)
treea665b0240e32b8e9553746924e2725aa56002700 /gcc/cp/call.c
parentdf44f2b0e98dccd15796b2e9af364c1704fba95e (diff)
downloadgcc-d9cf7c824593edf5fba4c00f41eaa1e791855c3e.zip
gcc-d9cf7c824593edf5fba4c00f41eaa1e791855c3e.tar.gz
gcc-d9cf7c824593edf5fba4c00f41eaa1e791855c3e.tar.bz2
c-common.c (combine_strings): Also set TREE_READONLY.
* c-common.c (combine_strings): Also set TREE_READONLY. Change warn_write_strings to flag_const_strings. * c-decl.c, c-tree.h: Likewise. cp/ * tree.c (lvalue_type): Fix for arrays. * typeck.c (string_conv_p): New fn. (convert_for_assignment): Use it. (build_unary_op): Use lvalue_type. * call.c (standard_conversion, convert_like): Use string_conv_p. (add_function_candidate): Use lvalue_type. * cvt.c (convert_to_reference): Likewise. * decl2.c (lang_decode_option): Ignore -traditional. * decl.c (init_decl_processing): flag_writable_strings inhibits flag_const_strings. * lang-options.h (lang_options): Add fconst-strings to the list of valid options. * decl2.c (lang_f_options, lang_decode_option): Likewise. From-SVN: r21928
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 3eb0817..7c1e683 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -883,6 +883,9 @@ standard_conversion (to, from, expr)
/* OK */;
else if (comp_ptr_ttypes (TREE_TYPE (to), TREE_TYPE (from)))
conv = build_conv (QUAL_CONV, to, conv);
+ else if (expr && string_conv_p (to, expr, 0))
+ /* converting from string constant to char *. */
+ conv = build_conv (QUAL_CONV, to, conv);
else if (ptr_reasonably_similar (TREE_TYPE (to), TREE_TYPE (from)))
{
conv = build_conv (PTR_CONV, to, conv);
@@ -3172,6 +3175,11 @@ convert_like (convs, expr)
case LVALUE_CONV:
return decay_conversion (expr);
+ case QUAL_CONV:
+ /* Warn about deprecated conversion if appropriate. */
+ string_conv_p (TREE_TYPE (convs), expr, 1);
+ break;
+
default:
break;
}