* parser.c (cp_parser_template_name): Clear
parser->context->object_type if we aren't doing lookup.
From-SVN: r245553
2017-02-17 Jason Merrill <jason@redhat.com>
+ PR c++/79508 - lookup error with member template
+ * parser.c (cp_parser_template_name): Clear
+ parser->context->object_type if we aren't doing lookup.
+
PR c++/78690 - ICE with using and global type with same name
* pt.c (type_dependent_object_expression_p): True for
IDENTIFIER_NODE.
cp_lexer_purge_tokens_after (parser->lexer, start);
if (is_identifier)
*is_identifier = true;
+ parser->context->object_type = NULL_TREE;
return identifier;
}
&& (!parser->scope
|| (TYPE_P (parser->scope)
&& dependent_type_p (parser->scope))))
- return identifier;
+ {
+ /* We're optimizing away the call to cp_parser_lookup_name, but we
+ still need to do this. */
+ parser->context->object_type = NULL_TREE;
+ return identifier;
+ }
}
/* Look up the name. */
--- /dev/null
+// PR c++/79508
+
+struct C
+{
+ template< void(*F)()> void set_default() { }
+};
+
+
+template <class T> void random_positive()
+{
+}
+
+template<class T> void initialize(T& x)
+{
+ x.template set_default<random_positive<T> >();
+}
+
+int main ()
+{
+ C x;
+ initialize<C>(x);
+}