re PR c++/28284 (ICE with invalid static const variable)

PR c++/28284
        * pt.c (fold_non_dependent_expr): Make sure expr is not dereferenced if it
        is NULL.

From-SVN: r116755
This commit is contained in:
Simon Martin 2006-09-07 17:25:05 +00:00 committed by Jason Merrill
parent c387622634
commit d4a200d359
3 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2006-09-07 Simon Martin <simartin@users.sourceforge.net>
PR c++/28284
* pt.c (fold_non_dependent_expr): Make sure expr is not dereferenced if it
is NULL.
2006-09-06 Zak Kipling <zak@transversal.com>
PR c++/26195

View File

@ -3410,6 +3410,9 @@ redeclare_class_template (tree type, tree parms)
tree
fold_non_dependent_expr (tree expr)
{
if (expr == NULL_TREE)
return NULL_TREE;
/* If we're in a template, but EXPR isn't value dependent, simplify
it. We're supposed to treat:

View File

@ -0,0 +1,12 @@
/* { dg-do compile } */
template<int> struct A
{
static const int i=x; /* { dg-error "was not declared in this scope" } */
static const int j, k;
};
template<int N> const int A<N>::j = i;
template<int N> const int A<N>::k = j;
A<0> a;