Commit d4a200d3 by Simon Martin Committed by Jason Merrill

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
parent c3876226
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> 2006-09-06 Zak Kipling <zak@transversal.com>
PR c++/26195 PR c++/26195
......
...@@ -3410,6 +3410,9 @@ redeclare_class_template (tree type, tree parms) ...@@ -3410,6 +3410,9 @@ redeclare_class_template (tree type, tree parms)
tree tree
fold_non_dependent_expr (tree expr) 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 /* If we're in a template, but EXPR isn't value dependent, simplify
it. We're supposed to treat: it. We're supposed to treat:
......
/* { 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;
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