From be197ade2e5fb42606339080b08e885824fb9644 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 31 Jan 2018 16:07:06 +0000 Subject: [PATCH] re PR c++/84092 (ICE on C++14 code with variable template: in build_qualified_name, at cp/tree.c:2043) /cp 2018-01-31 Paolo Carlini PR c++/84092 * semantics.c (finish_qualified_id_expr): When handling an UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr. /testsuite 2018-01-31 Paolo Carlini PR c++/84092 * g++.dg/cpp1y/var-templ57.C: New. From-SVN: r257242 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 12 ++++++------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1y/var-templ57.C | 4 ++++ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ57.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f89f3ce0274..ee06ba61546 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-01-31 Paolo Carlini + + PR c++/84092 + * semantics.c (finish_qualified_id_expr): When handling an + UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr. + 2018-01-31 Marek Polacek PR c++/84138 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b758051965e..76160345882 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2001,12 +2001,12 @@ finish_qualified_id_expr (tree qualifying_class, if (template_p) { if (TREE_CODE (expr) == UNBOUND_CLASS_TEMPLATE) - /* cp_parser_lookup_name thought we were looking for a type, - but we're actually looking for a declaration. */ - expr = build_qualified_name (/*type*/NULL_TREE, - TYPE_CONTEXT (expr), - TYPE_IDENTIFIER (expr), - /*template_p*/true); + { + /* cp_parser_lookup_name thought we were looking for a type, + but we're actually looking for a declaration. */ + qualifying_class = TYPE_CONTEXT (expr); + expr = TYPE_IDENTIFIER (expr); + } else check_template_keyword (expr); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 27c568508c9..60756dab0ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-31 Paolo Carlini + + PR c++/84092 + * g++.dg/cpp1y/var-templ57.C: New. + 2018-01-31 Marek Polacek PR c++/84138 diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ57.C b/gcc/testsuite/g++.dg/cpp1y/var-templ57.C new file mode 100644 index 00000000000..030e9a2dfd6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ57.C @@ -0,0 +1,4 @@ +// PR c++/84092 +// { dg-do compile { target c++14 } } + +template < typename T > int a (T::template b); -- 2.30.2