diff options
Diffstat (limited to 'gcc-4.8/gcc/cp/decl.c')
-rw-r--r-- | gcc-4.8/gcc/cp/decl.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc-4.8/gcc/cp/decl.c b/gcc-4.8/gcc/cp/decl.c index 893fbd161..e487f887d 100644 --- a/gcc-4.8/gcc/cp/decl.c +++ b/gcc-4.8/gcc/cp/decl.c @@ -1867,9 +1867,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) /* Merge the data types specified in the two decls. */ newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); - /* If merge_types produces a non-typedef type, just use the old type. */ - if (TREE_CODE (newdecl) == TYPE_DECL - && newtype == DECL_ORIGINAL_TYPE (newdecl)) + /* For typedefs use the old type, as the new type's DECL_NAME points + at newdecl, which will be ggc_freed. */ + if (TREE_CODE (newdecl) == TYPE_DECL) newtype = oldtype; if (TREE_CODE (newdecl) == VAR_DECL) @@ -8193,7 +8193,9 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) abi_1_itype = error_mark_node; } + if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type)) size = maybe_constant_value (size); + if (!TREE_CONSTANT (size)) size = osize; } @@ -8473,6 +8475,14 @@ create_array_type_for_decl (tree name, tree type, tree size) return error_mark_node; } + /* 8.3.4p1: ...if the type of the identifier of D contains the auto + type-specifier, the program is ill-formed. */ + if (type_uses_auto (type)) + { + error ("%qD declared as array of %qT", name, type); + return error_mark_node; + } + /* Figure out the index type for the array. */ if (size) itype = compute_array_index_type (name, size, tf_warning_or_error); @@ -11891,7 +11901,10 @@ lookup_and_check_tag (enum tag_types tag_code, tree name, if (decl && (DECL_CLASS_TEMPLATE_P (decl) - || DECL_TEMPLATE_TEMPLATE_PARM_P (decl))) + /* If scope is ts_current we're defining a class, so ignore a + template template parameter. */ + || (scope != ts_current + && DECL_TEMPLATE_TEMPLATE_PARM_P (decl)))) decl = DECL_TEMPLATE_RESULT (decl); if (decl && TREE_CODE (decl) == TYPE_DECL) |