diff options
author | Jason Merrill <jason@redhat.com> | 2017-07-06 14:26:59 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-07-06 14:26:59 -0400 |
commit | 9ddfe5f4202736b44f464ffabff0c3fb3f4b1d8b (patch) | |
tree | 340d544259ec950ec2a5ebb5d56c81712d865b98 /gcc | |
parent | d44b9748647114957e0215287f0889050f7e5da5 (diff) | |
download | gcc-9ddfe5f4202736b44f464ffabff0c3fb3f4b1d8b.zip gcc-9ddfe5f4202736b44f464ffabff0c3fb3f4b1d8b.tar.gz gcc-9ddfe5f4202736b44f464ffabff0c3fb3f4b1d8b.tar.bz2 |
PR c++/81204 - parse error with dependent template-name
PR c++/81204 - parse error with dependent template-name
* parser.c (cp_parser_lookup_name): Revert previous change.
From-SVN: r250037
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/parser.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C | 9 |
3 files changed, 19 insertions, 16 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2617fff..3af0c43 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-07-06 Jason Merrill <jason@redhat.com> + + PR c++/81204 - parse error with dependent template-name + * parser.c (cp_parser_lookup_name): Revert previous change. + 2017-07-06 David Malcolm <dmalcolm@redhat.com> * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index dbe0052..c81b1a1f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -25855,22 +25855,11 @@ cp_parser_lookup_name (cp_parser *parser, tree name, decl = NULL_TREE; if (!decl) - { - /* 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; - } - } + /* 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); 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. */ diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C new file mode 100644 index 0000000..4a02ab2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C @@ -0,0 +1,9 @@ +// { dg-do compile { target c++11 } } + +template <class A0, class... As> struct tuple +{ + tuple<As...> tail; + template <int Offset, class... More> int apply(const More&... more) { + return tail.apply<1>(more...); // { dg-error "" } needs .template + } +}; |