PR c++/81204 - parse error with dependent template-name

* parser.c (cp_parser_lookup_name): Disqualify function templates
	after lookup.

From-SVN: r249761
This commit is contained in:
Jason Merrill 2017-06-28 17:08:43 -04:00 committed by Jason Merrill
parent 075a5f6aaf
commit 98626a3eea
3 changed files with 34 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2017-06-28 Jason Merrill <jason@redhat.com>
PR c++/81204 - parse error with dependent template-name
* parser.c (cp_parser_lookup_name): Disqualify function templates
after lookup.
2017-06-26 Jason Merrill <jason@redhat.com>
PR c++/81215

View File

@ -25661,11 +25661,22 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
decl = NULL_TREE;
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_real (name, prefer_type_arg (tag_type, is_template),
/*nonclass=*/0,
/*block_p=*/true, is_namespace, 0);
{
/* Look it up in the enclosing context. */
decl = lookup_name_real (name, prefer_type_arg (tag_type),
/*nonclass=*/0,
/*block_p=*/true, is_namespace, 0);
/* DR 141 says when looking for a template-name after -> or ., only
consider class templates. */
if (decl && is_template && !DECL_TYPE_TEMPLATE_P (decl))
{
tree d = decl;
if (is_overloaded_fn (d))
d = get_first_fn (d);
if (DECL_P (d) && !DECL_CLASS_SCOPE_P (d))
decl = NULL_TREE;
}
}
if (object_type == unknown_type_node)
/* The object is type-dependent, so we can't look anything up; we used
this to get the DR 141 behavior. */

View File

@ -0,0 +1,12 @@
// PR c++/81204
namespace std {
template<typename, typename> struct set { };
}
using namespace std;
template <int I, typename Result>
inline void set(Result & res)
{
res.template set<I>();
}