+2018-07-13 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/86374
+ * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
+ contexts that are classes.
+ * parser.c (cp_parser_template_id): Combine entering_scope decl &
+ initializer.
+
2018-07-12 Jakub Jelinek <jakub@redhat.com>
* decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
else if (DECL_TYPE_TEMPLATE_P (templ)
|| DECL_TEMPLATE_TEMPLATE_PARM_P (templ))
{
- bool entering_scope;
/* In "template <typename T> ... A<T>::", A<T> is the abstract A
template (rather than some instantiation thereof) only if
is not nested within some other construct. For example, in
"template <typename T> void f(T) { A<T>::", A<T> is just an
instantiation of A. */
- entering_scope = (template_parm_scope_p ()
- && cp_lexer_next_token_is (parser->lexer,
- CPP_SCOPE));
+ bool entering_scope
+ = (template_parm_scope_p ()
+ && cp_lexer_next_token_is (parser->lexer, CPP_SCOPE));
template_id
= finish_template_type (templ, arguments, entering_scope);
}
return found;
}
- context = tsubst (DECL_CONTEXT (gen_tmpl), arglist,
- complain, in_decl);
+ context = DECL_CONTEXT (gen_tmpl);
+ if (context && TYPE_P (context))
+ {
+ context = tsubst_aggr_type (context, arglist, complain, in_decl, true);
+ context = complete_type (context);
+ }
+ else
+ context = tsubst (context, arglist, complain, in_decl);
+
if (context == error_mark_node)
return error_mark_node;
+2018-07-13 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/86374
+ * g++.dg/pr86374.C: New.
+
2018-07-13 Qing Zhao <qing.zhao@oracle.com>
PR middle-end/78809
--- /dev/null
+// pr C++/86374
+// bogus lookup error
+template<typename LIST>
+struct list {
+ static const int index = 1;
+ template <typename> struct addWithChecking {};
+};
+
+template<typename container, int ix = container::index>
+struct find {
+ static const int result = 0;
+};
+
+template <class LIST>
+template<class O>
+struct list<LIST>::addWithChecking<O*>
+{
+ static const int xres =
+ find<list<LIST> >::result; // bogus error about index here.
+};