diff options
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r-- | gcc/java/class.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c index e0caeae..eb4be8e 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -777,6 +777,12 @@ set_constant_value (field, constant) else { DECL_INITIAL (field) = constant; + if (TREE_TYPE (constant) != TREE_TYPE (field) + && ! (TREE_TYPE (constant) == int_type_node + && INTEGRAL_TYPE_P (TREE_TYPE (field)) + && TYPE_PRECISION (TREE_TYPE (field)) <= 32)) + error ("ConstantValue attribute of field '%s' has wrong type", + IDENTIFIER_POINTER (DECL_NAME (field))); if (FIELD_FINAL (field)) DECL_FIELD_FINAL_IUD (field) = 1; } |