diff options
Diffstat (limited to 'contrib/gcc/cp/semantics.c')
| -rw-r--r-- | contrib/gcc/cp/semantics.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/contrib/gcc/cp/semantics.c b/contrib/gcc/cp/semantics.c index a4842036d8d3..a6f9afb083f5 100644 --- a/contrib/gcc/cp/semantics.c +++ b/contrib/gcc/cp/semantics.c @@ -2079,20 +2079,28 @@ tree finish_typeof (expr) tree expr; { + tree type; + if (processing_template_decl) { - tree t; + type = make_aggr_type (TYPEOF_TYPE); + TYPE_FIELDS (type) = expr; - t = make_aggr_type (TYPEOF_TYPE); - TYPE_FIELDS (t) = expr; - - return t; + return type; } if (TREE_CODE (expr) == OFFSET_REF) expr = resolve_offset_ref (expr); - return TREE_TYPE (expr); + type = TREE_TYPE (expr); + + if (!type || type == unknown_type_node) + { + error ("type of `%E' is unknown", expr); + return error_mark_node; + } + + return type; } /* Compute the value of the `sizeof' operator. */ |
