aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-11-16 05:05:20 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-11-16 00:05:20 -0500
commit848b92e1cc58303988dadd22623b904697084092 (patch)
tree0f6071e041f633ce262c6a0b66b63a6d1fb5e2eb /gcc
parent1f288b3fa1f207302986f89f2d76fa66c1c72b2d (diff)
downloadgcc-848b92e1cc58303988dadd22623b904697084092.zip
gcc-848b92e1cc58303988dadd22623b904697084092.tar.gz
gcc-848b92e1cc58303988dadd22623b904697084092.tar.bz2
decl.c (cplus_expand_expr_stmt): Promote warning about naked member function reference to error.
* decl.c (cplus_expand_expr_stmt): Promote warning about naked member function reference to error. * cvt.c (ocp_convert): Complain about converting an overloaded function to void. * init.c (build_offset_ref): Just return a lone static member function. * decl.c (cp_finish_decl): Only complain about real CONSTRUCTORs, not internal ones. * typeck.c (build_binary_op_nodefault): Improve error handling. * decl.c (grokfndecl): Complain about making 'main' a template. * typeck.c (string_conv_p): Don't convert from wchar_t[] to char*. * call.c (build_method_call): Handle a BIT_NOT_EXPR around a TYPE_DECL in a template. * typeck2.c (my_friendly_abort): Add URL in the other case, too. From-SVN: r23673
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog24
-rw-r--r--gcc/cp/call.c11
-rw-r--r--gcc/cp/cvt.c7
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/cp/typeck.c14
-rw-r--r--gcc/cp/typeck2.c1
7 files changed, 58 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 798b0a6..86503ae 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,29 @@
+1998-11-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cplus_expand_expr_stmt): Promote warning about naked
+ member function reference to error.
+ * cvt.c (ocp_convert): Complain about converting an overloaded
+ function to void.
+
+ * init.c (build_offset_ref): Just return a lone static member
+ function.
+
+ * decl.c (cp_finish_decl): Only complain about real CONSTRUCTORs,
+ not internal ones.
+
+ * typeck.c (build_binary_op_nodefault): Improve error handling.
+
+ * decl.c (grokfndecl): Complain about making 'main' a template.
+
+ * typeck.c (string_conv_p): Don't convert from wchar_t[] to char*.
+
+ * call.c (build_method_call): Handle a BIT_NOT_EXPR around a
+ TYPE_DECL in a template.
+
1998-11-15 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck2.c (my_friendly_abort): Add URL in the other case, too.
+
* decl.c (struct cp_function): Add named_label_uses.
(push_cp_function_context): Save it.
(pop_cp_function_context): Restore it.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 58914e3..a502a76 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -625,10 +625,15 @@ build_method_call (instance, name, parms, basetype_path, flags)
{
/* We need to process template parm names here so that tsubst catches
them properly. Other type names can wait. */
- if (TREE_CODE (name) == BIT_NOT_EXPR
- && TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
+ if (TREE_CODE (name) == BIT_NOT_EXPR)
{
- tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
+ tree type = NULL_TREE;
+
+ if (TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
+ type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
+ else if (TREE_CODE (TREE_OPERAND (name, 0)) == TYPE_DECL)
+ type = TREE_TYPE (TREE_OPERAND (name, 0));
+
if (type && TREE_CODE (type) == TEMPLATE_TYPE_PARM)
name = build_min_nt (BIT_NOT_EXPR, type);
}
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 84d3c67..981cf7b 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -683,7 +683,12 @@ ocp_convert (type, expr, convtype, flags)
}
if (code == VOID_TYPE && (convtype & CONV_STATIC))
- return build1 (CONVERT_EXPR, type, e);
+ {
+ if (type_unknown_p (e))
+ error ("address of overloaded function with no contextual type information");
+
+ return build1 (CONVERT_EXPR, type, e);
+ }
#if 0
/* This is incorrect. A truncation can't be stripped this way.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 70fc9fc..33c44494 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7217,7 +7217,8 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
{
if (TREE_CODE (type) == ARRAY_TYPE)
init = digest_init (type, init, (tree *) 0);
- else if (TREE_CODE (init) == CONSTRUCTOR)
+ else if (TREE_CODE (init) == CONSTRUCTOR
+ && TREE_HAS_CONSTRUCTOR (init))
{
if (TYPE_NON_AGGREGATE_CLASS (type))
{
@@ -8073,6 +8074,8 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
if (ctype == NULL_TREE && DECL_MAIN_P (decl))
{
+ if (processing_template_decl)
+ error ("cannot declare `main' to be a template");
if (inlinep)
error ("cannot declare `main' to be inline");
else if (! publicp)
@@ -13891,7 +13894,7 @@ cplus_expand_expr_stmt (exp)
if (TREE_CODE (exp) == ADDR_EXPR || TREE_CODE (exp) == TREE_LIST)
error ("address of overloaded function with no contextual type information");
else if (TREE_CODE (exp) == COMPONENT_REF)
- warning ("useless reference to a member function name, did you forget the ()?");
+ error ("invalid reference to a member function name, did you forget the ()?");
}
else
{
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 78f026a..e923230 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1618,6 +1618,8 @@ build_offset_ref (type, name)
return error_mark_node;
}
mark_used (t);
+ if (DECL_STATIC_FUNCTION_P (t))
+ return t;
return build (OFFSET_REF, TREE_TYPE (t), decl, t);
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 1322078..aa026ae 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1769,8 +1769,15 @@ string_conv_p (totype, exp, warn)
&& !same_type_p (t, wchar_type_node))
return 0;
- if (TREE_CODE (exp) != STRING_CST)
+ if (TREE_CODE (exp) == STRING_CST)
{
+ /* Make sure that we don't try to convert between char and wchar_t. */
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (exp))) != t)
+ return 0;
+ }
+ else
+ {
+ /* Is this a string constant which has decayed to 'const char *'? */
t = build_pointer_type (build_qualified_type (t, TYPE_QUAL_CONST));
if (!same_type_p (TREE_TYPE (exp), t))
return 0;
@@ -1782,7 +1789,7 @@ string_conv_p (totype, exp, warn)
/* This warning is not very useful, as it complains about printf. */
if (warn && warn_write_strings)
- cp_warning ("deprecated conversion from string constant to `char *'");
+ cp_warning ("deprecated conversion from string constant to `%T'", totype);
return 1;
}
@@ -3938,6 +3945,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
op0 = cp_convert (result_type, op0);
if (TREE_TYPE (op1) != result_type)
op1 = cp_convert (result_type, op1);
+
+ if (op0 == error_mark_node || op1 == error_mark_node)
+ return error_mark_node;
}
if (build_type == NULL_TREE)
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 908bb08..3cdf723 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -396,6 +396,7 @@ my_friendly_abort (i)
error ("Internal compiler error %d.", i);
fatal ("Please submit a full bug report to `egcs-bugs@cygnus.com'.");
+ fatal ("See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.");
}
void