re PR c++/28048 (ICE on accessing member of dependent name)
authorMark Mitchell <mark@codesourcery.com>
Wed, 19 Jul 2006 05:14:25 +0000 (05:14 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 19 Jul 2006 05:14:25 +0000 (05:14 +0000)
PR c++/28048
* semantics.c (check_accessibility_of_qualified_id): Robustify.
PR c++/28048
* g++.dg/template/defarg9.C: New test.

From-SVN: r115579

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/defarg9.C [new file with mode: 0644]

index 2f22450fb82b6a53c30bedb79065db37422741c0..af163dd644eff2425fb70c364b60777f56b84aaa 100644 (file)
@@ -1,5 +1,8 @@
 2006-07-18  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/28048
+       * semantics.c (check_accessibility_of_qualified_id): Robustify.
+
        PR c++/28235
        * pt.c (tsubst_decl): Handling substitutions into a static data
        member from within the scope of the tempalte itself.
index 951f9f4bd590b412ed86290f0160b029b77f93b4..4577bd386f9a0fc9661bdfe5ae63916769d58db5 100644 (file)
@@ -1506,9 +1506,11 @@ check_accessibility_of_qualified_id (tree decl,
        its bases.  */
     qualifying_type = currently_open_derived_class (scope);
 
-  if (qualifying_type && IS_AGGR_TYPE_CODE (TREE_CODE (qualifying_type)))
-    /* It is possible for qualifying type to be a TEMPLATE_TYPE_PARM
-       or similar in a default argument value.  */
+  if (qualifying_type 
+      /* It is possible for qualifying type to be a TEMPLATE_TYPE_PARM
+        or similar in a default argument value.  */
+      && CLASS_TYPE_P (qualifying_type)
+      && !dependent_type_p (qualifying_type))
     perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl);
 }
 
index 604b6cdb06d95cf1459d9575dc0c73ef4f013730..5e5470d266d47a072c6d5fb36dddcc663fe70161 100644 (file)
@@ -1,5 +1,8 @@
 2006-07-18  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/28048
+       * g++.dg/template/defarg9.C: New test.
+
        PR c++/28235
        * g++.dg/template/static27.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/defarg9.C b/gcc/testsuite/g++.dg/template/defarg9.C
new file mode 100644 (file)
index 0000000..de7528f
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/28048
+
+template<typename T> struct Boom;
+
+template<typename T, bool D = Boom<T>::Internal::Value> // <--ICE
+    struct Foo
+    {
+    };
+
+template<typename T> struct Boom
+{
+    struct Internal
+    {
+      static const bool Value = false;
+    };
+};