re PR c++/28741 (ICE with static member in invalid template class)

PR c++/28741
        * tree.c (decl_anon_ns_mem_p): Robustify.
        * decl2.c (determine_visibility): Likewise.

        * g++.dg/template/void7.C: New test.

From-SVN: r116303
This commit is contained in:
Lee Millward 2006-08-21 17:41:18 +00:00 committed by Lee Millward
parent 623c65f173
commit 653109bdf2
5 changed files with 32 additions and 13 deletions

View File

@ -8,6 +8,10 @@
* decl.c (grokdeclarator): Return early after
issuing diagnostic about an incomplete type.
PR c++/28741
* tree.c (decl_anon_ns_mem_p): Robustify.
* decl2.c (determine_visibility): Likewise.
2006-08-20 Mark Mitchell <mark@codesourcery.com>
PR c++/28341

View File

@ -1753,6 +1753,9 @@ determine_visibility (tree decl)
? TYPE_TEMPLATE_INFO (TREE_TYPE (decl))
: DECL_TEMPLATE_INFO (decl));
tree args = TI_ARGS (tinfo);
if (args != error_mark_node)
{
int depth = TMPL_ARGS_DEPTH (args);
tree pattern = DECL_TEMPLATE_RESULT (TI_TEMPLATE (tinfo));
@ -1768,6 +1771,7 @@ determine_visibility (tree decl)
/* Limit visibility based on its template arguments. */
constrain_visibility_for_template (decl, args);
}
}
if (class_type)
determine_visibility_from_class (decl, class_type);

View File

@ -1393,7 +1393,7 @@ decl_anon_ns_mem_p (tree decl)
{
while (1)
{
if (decl == NULL_TREE)
if (decl == NULL_TREE || decl == error_mark_node)
return false;
if (TREE_CODE (decl) == NAMESPACE_DECL
&& DECL_NAME (decl) == NULL_TREE)

View File

@ -7,6 +7,9 @@
* g++.dg/parse/ctor7.C: New test.
* g++.dg/parse/ctor8.C: Likewise.
PR c++/28741
* g++.dg/template/void7.C: New test.
2006-08-21 Olivier Hainque <hainque@adacore.com>
* gnat.dg/self_aggregate_with_zeros.adb: New test.

View File

@ -0,0 +1,8 @@
//PR c++/28741
template<void> struct A // { dg-error "not a valid type" }
{
static int i;
};
A<0> a;