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
This commit is contained in:
Simon Martin 2009-07-06 04:55:20 +00:00 committed by Simon Martin
parent e2e23550fc
commit c4efba1c21
4 changed files with 28 additions and 3 deletions

View 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

View 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);

View 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.

View File

@ -0,0 +1,12 @@
/* PR c++/40557 */
/* { dg-do "compile" } */
struct A
{
typedef int X;
};
template<int> union B
{
A::X x;
};