OSDN Git Service

gcc/cp/
authorsimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Jul 2009 04:55:20 +0000 (04:55 +0000)
committersimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Jul 2009 04:55:20 +0000 (04:55 +0000)
2009-07-06  Simon Martin  <simartin@users.sourceforge.net>

PR c++/40557
* pt.c (perform_typedefs_access_check, get_types_needing_access_check,
append_type_to_template_for_access_check_1): Use
RECORD_OR_UNION_CODE_P.

gcc/testsuite/

2009-07-06  Simon Martin  <simartin@users.sourceforge.net>

PR c++/40557
* g++.dg/template/union2.C: New test.

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

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

index e3fe9c2..03a0349 100644 (file)
@@ -1,3 +1,10 @@
+2009-07-06  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c++/40557
+       * pt.c (perform_typedefs_access_check, get_types_needing_access_check,
+       append_type_to_template_for_access_check_1): Use
+       RECORD_OR_UNION_CODE_P.
+
 2009-07-04  Jason Merrill  <jason@redhat.com>
 
        * pt.c (retrieve_specialization): Don't get confused by a
index 4143bb1..f1104e2 100644 (file)
@@ -7142,7 +7142,7 @@ perform_typedefs_access_check (tree tmpl, tree targs)
   tree t;
 
   if (!tmpl
-      || (TREE_CODE (tmpl) != RECORD_TYPE
+      || (!RECORD_OR_UNION_CODE_P (TREE_CODE (tmpl))
          && TREE_CODE (tmpl) != FUNCTION_DECL))
     return;
 
@@ -17512,7 +17512,8 @@ get_types_needing_access_check (tree t)
   if (!(ti = get_template_info (t)))
     return NULL_TREE;
 
-  if (TREE_CODE (t) == RECORD_TYPE || TREE_CODE (t) == FUNCTION_DECL)
+  if (RECORD_OR_UNION_CODE_P (TREE_CODE (t))
+      || TREE_CODE (t) == FUNCTION_DECL)
     {
       if (!TI_TEMPLATE (ti))
        return NULL_TREE;
@@ -17544,7 +17545,7 @@ append_type_to_template_for_access_check_1 (tree t,
     return;
 
   gcc_assert ((TREE_CODE (t) == FUNCTION_DECL
-              || TREE_CODE (t) == RECORD_TYPE)
+              || RECORD_OR_UNION_CODE_P (TREE_CODE (t)))
              && type_decl
              && TREE_CODE (type_decl) == TYPE_DECL
              && scope);
index da27711..d4f4d05 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-06  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c++/40557
+       * g++.dg/template/union2.C: New test.
+
 2009-07-04  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/template/using15.C: New.
diff --git a/gcc/testsuite/g++.dg/template/union2.C b/gcc/testsuite/g++.dg/template/union2.C
new file mode 100644 (file)
index 0000000..9e0666e
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR c++/40557 */
+/* { dg-do "compile" } */
+
+struct A
+{
+  typedef int X;
+};
+
+template<int> union B
+{
+  A::X x;
+};