summaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-09 21:50:23 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-09 21:50:23 +0000
commitb1bbc8e575369a5d043531349984c81cd3fc0277 (patch)
treedf909e57688b1155ec89d442b57ba0b2026135a9 /gcc/c-family
parentfe5f0da48681bc0b6f8174cbe11e83745cc84ca2 (diff)
downloadgcc-b1bbc8e575369a5d043531349984c81cd3fc0277.tar.gz
gcc/
* c-typeck.c (build_indirect_ref): Call invalid_indirection_error. gcc/c-family/ * c-common.h (invalid_indirection_error): Declare. * c-common.c (invalid_indirection_error): Define. gcc/cp/ * typeck.c (cp_build_indirect_ref): Call invalid_indirection_error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167666 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-common.c37
-rw-r--r--gcc/c-family/c-common.h1
3 files changed, 43 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 2ea3960170f..495816b6a00 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2010-12-09 Nathan Froyd <froydnj@codesourcery.com>
+
+ * c-common.h (invalid_indirection_error): Declare.
+ * c-common.c (invalid_indirection_error): Define.
+
2010-12-03 Richard Guenther <rguenther@suse.de>
PR c/46745
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 7a57838a857..8d0fcc388fe 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8585,6 +8585,43 @@ lvalue_error (enum lvalue_use use)
gcc_unreachable ();
}
}
+
+/* Print an error message for an invalid indirection of type TYPE.
+ ERRSTRING is the name of the operator for the indirection. */
+
+void
+invalid_indirection_error (location_t loc, tree type, ref_operator errstring)
+{
+ switch (errstring)
+ {
+ case RO_NULL:
+ gcc_assert (c_dialect_cxx ());
+ error_at (loc, "invalid type argument (have %qT)", type);
+ break;
+ case RO_ARRAY_INDEXING:
+ error_at (loc,
+ "invalid type argument of array indexing (have %qT)",
+ type);
+ break;
+ case RO_UNARY_STAR:
+ error_at (loc,
+ "invalid type argument of unary %<*%> (have %qT)",
+ type);
+ break;
+ case RO_ARROW:
+ error_at (loc,
+ "invalid type argument of %<->%> (have %qT)",
+ type);
+ break;
+ case RO_IMPLICIT_CONVERSION:
+ error_at (loc,
+ "invalid type argument of implicit conversion (have %qT)",
+ type);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+}
/* *PTYPE is an incomplete array. Complete it with a domain based on
INITIAL_VALUE. If INITIAL_VALUE is not present, use 1 if DO_DEFAULT
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 928e5021d23..b6f8d398657 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -929,6 +929,7 @@ enum lvalue_use {
};
extern void lvalue_error (enum lvalue_use);
+extern void invalid_indirection_error (location_t, tree, ref_operator);
extern int complete_array_type (tree *, tree, bool);