/* Utility Routines */
static cp_expr cp_parser_lookup_name
- (cp_parser *, tree, enum tag_types, bool, bool, bool, tree *, location_t);
+ (cp_parser *, tree, enum tag_types, int, bool, bool, tree *, location_t);
static tree cp_parser_lookup_name_simple
(cp_parser *, tree, location_t);
static tree cp_parser_maybe_treat_template_as_class
/* Look up the name. */
decl = cp_parser_lookup_name (parser, identifier,
tag_type,
- /*is_template=*/true,
+ /*is_template=*/1 + template_keyword_p,
/*is_namespace=*/false,
check_dependency_p,
/*ambiguous_decls=*/NULL,
refer to types are ignored.
If IS_TEMPLATE is TRUE, bindings that do not refer to templates are
- ignored.
+ ignored. If IS_TEMPLATE IS 2, the 'template' keyword was specified.
If IS_NAMESPACE is TRUE, bindings that do not refer to namespaces
are ignored.
static cp_expr
cp_parser_lookup_name (cp_parser *parser, tree name,
enum tag_types tag_type,
- bool is_template,
+ int is_template,
bool is_namespace,
bool check_dependency,
tree *ambiguous_decls,
else
decl = NULL_TREE;
- if (!decl)
+ /* If we didn't find a member and have dependent bases, the member lookup
+ is now dependent. */
+ if (!dep && !decl && any_dependent_bases_p (object_type))
+ dep = true;
+
+ if (dep && is_template == 2)
+ /* The template keyword specifies a dependent template. */;
+ else if (!decl)
/* Look it up in the enclosing context. DR 141: When looking for a
template-name after -> or ., only consider class templates. */
decl = lookup_name (name, is_namespace ? LOOK_want::NAMESPACE
/* If we know we're looking for a type (e.g. A in p->A::x),
mock up a typename. */
- if (!decl && object_type && tag_type != none_type
- && dependentish_scope_p (object_type))
+ if (!decl && dep && tag_type != none_type)
{
tree type = build_typename_type (object_type, name, name,
typename_type);