From: Nathan Sidwell Date: Tue, 24 Aug 2004 09:04:06 +0000 (+0000) Subject: re PR c++/17149 (ICE: tree check: expected record_type or union_type or qual_union_ty... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c645999e7b458447806f01170dda9e99a5805e17;p=gcc.git re PR c++/17149 (ICE: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in check_accessibility_of_qualified_id, at cp/semantics.c:1388) cp: PR c++/17149 * semantics.c (check_accessibility_of_qualified_id): Defer check if qualifying_type is a template parameter. testsuite: PR c++/17149 * g++.dg/template/access15.C: New. From-SVN: r86472 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7e013c79225..ddeb19ed164 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-08-24 Nathan Sidwell + + PR c++/17149 + * semantics.c (check_accessibility_of_qualified_id): Defer check + if qualifying_type is a template parameter. + 2004-08-23 Mark Mitchell PR c++/17163 @@ -11,7 +17,7 @@ Revert: 2004-08-22 Andrew Pinski PR c++/14029 - * typeck.c (build_unary_op): Use &a.b if the foldded lowered + * typeck.c (build_unary_op): Use &a.b if the folded lowered expression is not constant. 2004-08-23 Nathan Sidwell @@ -23,7 +29,7 @@ 2004-08-22 Andrew Pinski PR c++/14029 - * typeck.c (build_unary_op): Use &a.b if the foldded lowered + * typeck.c (build_unary_op): Use &a.b if the folded lowered expression is not constant. 2004-08-20 Mark Mitchell diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 302d00ecc77..b221cd20b1c 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1384,7 +1384,9 @@ check_accessibility_of_qualified_id (tree decl, its bases. */ qualifying_type = currently_open_derived_class (scope); - if (qualifying_type) + 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. */ perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 343d3bba591..59138e2cd2a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-24 Nathan Sidwell + + PR c++/17149 + * g++.dg/template/access15.C: New. + 2004-08-23 Mark Mitchell PR c++/17163 diff --git a/gcc/testsuite/g++.dg/template/access15.C b/gcc/testsuite/g++.dg/template/access15.C new file mode 100644 index 00000000000..e28716366e7 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/access15.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +// Copyright (C) 2004 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 23 Aug 2004 +// Origin: stefaandr@hotmail.com + +// Bug 17149: ICE with TEMPLATE_TYPE_PARM + + +template +struct x {};