mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 23:41:01 +08:00
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:
parent
c387622634
commit
d4a200d359
@ -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
|
||||
|
@ -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:
|
||||
|
||||
|
12
gcc/testsuite/g++.dg/template/pr28284.C
Normal file
12
gcc/testsuite/g++.dg/template/pr28284.C
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user