PR c++/78690 - ICE with using and global type with same name
authorJason Merrill <jason@redhat.com>
Fri, 17 Feb 2017 20:28:38 +0000 (15:28 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 17 Feb 2017 20:28:38 +0000 (15:28 -0500)
* pt.c (type_dependent_object_expression_p): True for
IDENTIFIER_NODE.

From-SVN: r245549

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/dependent-scope1.C [new file with mode: 0644]

index a660c434c7945a2f00dad346d529f30b19266618..2e2cd6c48c5580fb0ccec761d25f5dff0f6f07d4 100644 (file)
@@ -1,5 +1,9 @@
 2017-02-17  Jason Merrill  <jason@redhat.com>
 
+       PR c++/78690 - ICE with using and global type with same name
+       * pt.c (type_dependent_object_expression_p): True for
+       IDENTIFIER_NODE.
+
        PR c++/79549 - C++17 ICE with non-type auto template parameter pack
        * pt.c (convert_template_argument): Just return an auto arg pack.
        (tsubst_template_args): Don't tsubst an auto pack type.
index 04479d4d48642c8ed80844fb1e61ff096eb1991c..9e6ce8d51def88cb54b50ba95f5714432956d90c 100644 (file)
@@ -23932,6 +23932,10 @@ type_dependent_expression_p (tree expression)
 bool
 type_dependent_object_expression_p (tree object)
 {
+  /* An IDENTIFIER_NODE can sometimes have a TREE_TYPE, but it's still
+     dependent.  */
+  if (TREE_CODE (object) == IDENTIFIER_NODE)
+    return true;
   tree scope = TREE_TYPE (object);
   return (!scope || dependent_scope_p (scope));
 }
diff --git a/gcc/testsuite/g++.dg/template/dependent-scope1.C b/gcc/testsuite/g++.dg/template/dependent-scope1.C
new file mode 100644 (file)
index 0000000..a5c18c4
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/78690
+
+struct C;
+
+template <typename T>
+struct A
+{
+  struct C { static void bar (); };
+};
+
+template <typename T>
+struct B
+{
+  using A<T>::C;
+  void
+  foo () { C.bar (); }
+};