re PR c++/84092 (ICE on C++14 code with variable template: in build_qualified_name...
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 31 Jan 2018 16:07:06 +0000 (16:07 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 31 Jan 2018 16:07:06 +0000 (16:07 +0000)
/cp
2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>

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  <paolo.carlini@oracle.com>

PR c++/84092
* g++.dg/cpp1y/var-templ57.C: New.

From-SVN: r257242

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/var-templ57.C [new file with mode: 0644]

index f89f3ce0274cba71c76a89ebcb4311e3941fbf1c..ee06ba61546bd1f8043a34d43f3656bed18d05df 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       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  <polacek@redhat.com>
 
        PR c++/84138
index b758051965e5fd8a1b3b0006a21e72e3d68ff9e3..76160345882ed64321d3becf7fbd0c05b34e5b42 100644 (file)
@@ -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);
     }
index 27c568508c9a417ce56796aa743315b207226913..60756dab0eadeb518ed6838132219e2621fc6f40 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/84092
+       * g++.dg/cpp1y/var-templ57.C: New.
+
 2018-01-31  Marek Polacek  <polacek@redhat.com>
 
        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 (file)
index 0000000..030e9a2
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/84092
+// { dg-do compile { target c++14 } }
+
+template < typename T > int a (T::template b);