OSDN Git Service

PR c++/28048
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jul 2006 05:14:25 +0000 (05:14 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jul 2006 05:14:25 +0000 (05:14 +0000)
* semantics.c (check_accessibility_of_qualified_id): Robustify.
PR c++/28048
* g++.dg/template/defarg9.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115579 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 2f22450..af163dd 100644 (file)
@@ -1,5 +1,8 @@
 2006-07-18  Mark Mitchell  <mark@codesourcery.com>
 
 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.
        PR c++/28235
        * pt.c (tsubst_decl): Handling substitutions into a static data
        member from within the scope of the tempalte itself.
index 951f9f4..4577bd3 100644 (file)
@@ -1506,9 +1506,11 @@ check_accessibility_of_qualified_id (tree decl,
        its bases.  */
     qualifying_type = currently_open_derived_class (scope);
 
        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);
 }
 
     perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl);
 }
 
index 604b6cd..5e5470d 100644 (file)
@@ -1,5 +1,8 @@
 2006-07-18  Mark Mitchell  <mark@codesourcery.com>
 
 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.
 
        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;
+    };
+};