diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-05-02 18:04:18 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-05-02 18:04:18 +0000 |
commit | 80f5bb34eb5fc1e916ae2983e86876f0ecb6651c (patch) | |
tree | 2ce95d7eb645836e91c85fc664e62f305180d0d0 /gcc | |
parent | f1419b42511902582af98312ee45e6b23d9a875b (diff) | |
download | gcc-80f5bb34eb5fc1e916ae2983e86876f0ecb6651c.zip gcc-80f5bb34eb5fc1e916ae2983e86876f0ecb6651c.tar.gz gcc-80f5bb34eb5fc1e916ae2983e86876f0ecb6651c.tar.bz2 |
decl.c (compute_array_index_type): Don't try to do anything with the indices when processing a template.
* decl.c (compute_array_index_type): Don't try to do anything with
the indices when processing a template.
From-SVN: r41770
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/array7.C | 11 |
3 files changed, 22 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 76c301b..cb625ed 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-05-02 Mark Mitchell <mark@codesourcery.com> + + * decl.c (compute_array_index_type): Don't try to do anything with + the indices when processing a template. + 2001-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * call.c: NULL_PTR -> NULL. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 308d62f..0e8a44b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9224,12 +9224,6 @@ compute_array_index_type (name, size) { tree itype; - /* The size might be the result of a cast. */ - STRIP_TYPE_NOPS (size); - - /* It might be a const variable or enumeration constant. */ - size = decl_constant_value (size); - /* If this involves a template parameter, it will be a constant at instantiation time, but we don't know what the value is yet. Even if no template parameters are involved, we may an expression @@ -9252,6 +9246,12 @@ compute_array_index_type (name, size) size, integer_one_node)); } + /* The size might be the result of a cast. */ + STRIP_TYPE_NOPS (size); + + /* It might be a const variable or enumeration constant. */ + size = decl_constant_value (size); + /* The array bound must be an integer type. */ if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE diff --git a/gcc/testsuite/g++.old-deja/g++.pt/array7.C b/gcc/testsuite/g++.old-deja/g++.pt/array7.C new file mode 100644 index 0000000..02e0733 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/array7.C @@ -0,0 +1,11 @@ +// Build don't link: +// Origin: Mark Mitchell <mark@codesourcery.com> + +template <typename T> +struct S { + enum E { e = 5 }; + static int i[e]; +}; + +template <typename T> +int S<T>::i[S<T>::e]; |