diff options
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 068754a6a53..508e2529fbe 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2369,7 +2369,7 @@ finish_compound_literal (tree type, tree compound_literal, && check_array_initializer (NULL_TREE, type, compound_literal)) return error_mark_node; compound_literal = reshape_init (type, compound_literal, complain); - if (cxx_dialect >= cxx0x && SCALAR_TYPE_P (type) + if (SCALAR_TYPE_P (type) && !BRACE_ENCLOSED_INITIALIZER_P (compound_literal)) check_narrowing (type, compound_literal); if (TREE_CODE (type) == ARRAY_TYPE @@ -2733,15 +2733,17 @@ finish_template_decl (tree parms) tree finish_template_type (tree name, tree args, int entering_scope) { - tree decl; + tree type; - decl = lookup_template_class (name, args, + type = lookup_template_class (name, args, NULL_TREE, NULL_TREE, entering_scope, tf_warning_or_error | tf_user); - if (decl != error_mark_node) - decl = TYPE_STUB_DECL (decl); - - return decl; + if (type == error_mark_node) + return type; + else if (CLASS_TYPE_P (type) && !alias_type_or_template_p (type)) + return TYPE_STUB_DECL (type); + else + return TYPE_NAME (type); } /* Finish processing a BASE_CLASS with the indicated ACCESS_SPECIFIER. @@ -3286,8 +3288,9 @@ finish_id_expression (tree id_expression, if (TREE_CODE (first_fn) == TEMPLATE_DECL) first_fn = DECL_TEMPLATE_RESULT (first_fn); - if (!really_overloaded_fn (decl)) - mark_used (first_fn); + if (!really_overloaded_fn (decl) + && !mark_used (first_fn)) + return error_mark_node; if (!template_arg_p && TREE_CODE (first_fn) == FUNCTION_DECL @@ -3568,7 +3571,7 @@ finish_offsetof (tree expr) if (!complete_type_or_else (TREE_TYPE (object), object)) return error_mark_node; } - return fold_offsetof (expr, NULL_TREE); + return fold_offsetof (expr); } /* Replace the AGGR_INIT_EXPR at *TP with an equivalent CALL_EXPR. This |