return type;
}
-/* Lookup NAME in elaborate type specifier in scope according to
- SCOPE and issue diagnostics if necessary.
- Return *_TYPE node upon success, NULL_TREE when the NAME is not
- found, and ERROR_MARK_NODE for type error. */
+/* Lookup NAME of an elaborated type specifier according to SCOPE and
+ issue diagnostics if necessary. Return *_TYPE node upon success,
+ NULL_TREE when the NAME is not found, and ERROR_MARK_NODE for type
+ error. */
static tree
lookup_and_check_tag (enum tag_types tag_code, tree name,
/* In case of anonymous name, xref_tag is only called to
make type node and push name. Name lookup is not required. */
tree t = NULL_TREE;
- if (scope != ts_lambda && !IDENTIFIER_ANON_P (name))
+ if (!IDENTIFIER_ANON_P (name))
t = lookup_and_check_tag (tag_code, name, scope, template_header_p);
-
+
if (t == error_mark_node)
return error_mark_node;
error ("use of enum %q#D without previous declaration", name);
return error_mark_node;
}
- else
- {
- t = make_class_type (code);
- TYPE_CONTEXT (t) = context;
- if (scope == ts_lambda)
- {
- /* Mark it as a lambda type. */
- CLASSTYPE_LAMBDA_EXPR (t) = error_mark_node;
- /* And push it into current scope. */
- scope = ts_current;
- }
- t = pushtag (name, t, scope);
- }
+
+ t = make_class_type (code);
+ TYPE_CONTEXT (t) = context;
+ if (IDENTIFIER_LAMBDA_P (name))
+ /* Mark it as a lambda type right now. Our caller will
+ correct the value. */
+ CLASSTYPE_LAMBDA_EXPR (t) = error_mark_node;
+ t = pushtag (name, t, scope);
}
else
{
/* Create the new RECORD_TYPE for this lambda. */
tree type = xref_tag (/*tag_code=*/record_type, name,
- /*scope=*/ts_lambda, /*template_header_p=*/false);
+ /*scope=*/ts_current, /*template_header_p=*/false);
if (type == error_mark_node)
return error_mark_node;