Commit 80f5bb34 by Mark Mitchell Committed by Mark Mitchell

decl.c (compute_array_index_type): Don't try to do anything with the indices…

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
parent f1419b42
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> 2001-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* call.c: NULL_PTR -> NULL. * call.c: NULL_PTR -> NULL.
......
...@@ -9224,12 +9224,6 @@ compute_array_index_type (name, size) ...@@ -9224,12 +9224,6 @@ compute_array_index_type (name, size)
{ {
tree itype; 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 /* If this involves a template parameter, it will be a constant at
instantiation time, but we don't know what the value is yet. instantiation time, but we don't know what the value is yet.
Even if no template parameters are involved, we may an expression Even if no template parameters are involved, we may an expression
...@@ -9252,6 +9246,12 @@ compute_array_index_type (name, size) ...@@ -9252,6 +9246,12 @@ compute_array_index_type (name, size)
size, integer_one_node)); 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. */ /* The array bound must be an integer type. */
if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE
&& TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE
......
// 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];
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