Commit c4efba1c by Simon Martin Committed by Simon Martin

re PR c++/40557 (ICE with template union)

gcc/cp/

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.

From-SVN: r149276
parent e2e23550
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> 2009-07-04 Jason Merrill <jason@redhat.com>
* pt.c (retrieve_specialization): Don't get confused by a * pt.c (retrieve_specialization): Don't get confused by a
......
...@@ -7142,7 +7142,7 @@ perform_typedefs_access_check (tree tmpl, tree targs) ...@@ -7142,7 +7142,7 @@ perform_typedefs_access_check (tree tmpl, tree targs)
tree t; tree t;
if (!tmpl if (!tmpl
|| (TREE_CODE (tmpl) != RECORD_TYPE || (!RECORD_OR_UNION_CODE_P (TREE_CODE (tmpl))
&& TREE_CODE (tmpl) != FUNCTION_DECL)) && TREE_CODE (tmpl) != FUNCTION_DECL))
return; return;
...@@ -17512,7 +17512,8 @@ get_types_needing_access_check (tree t) ...@@ -17512,7 +17512,8 @@ get_types_needing_access_check (tree t)
if (!(ti = get_template_info (t))) if (!(ti = get_template_info (t)))
return NULL_TREE; 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)) if (!TI_TEMPLATE (ti))
return NULL_TREE; return NULL_TREE;
...@@ -17544,7 +17545,7 @@ append_type_to_template_for_access_check_1 (tree t, ...@@ -17544,7 +17545,7 @@ append_type_to_template_for_access_check_1 (tree t,
return; return;
gcc_assert ((TREE_CODE (t) == FUNCTION_DECL gcc_assert ((TREE_CODE (t) == FUNCTION_DECL
|| TREE_CODE (t) == RECORD_TYPE) || RECORD_OR_UNION_CODE_P (TREE_CODE (t)))
&& type_decl && type_decl
&& TREE_CODE (type_decl) == TYPE_DECL && TREE_CODE (type_decl) == TYPE_DECL
&& scope); && scope);
......
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> 2009-07-04 Jason Merrill <jason@redhat.com>
* g++.dg/template/using15.C: New. * g++.dg/template/using15.C: New.
......
/* PR c++/40557 */
/* { dg-do "compile" } */
struct A
{
typedef int X;
};
template<int> union B
{
A::X x;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment