Message ID | 4D7A54A6.1000206@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 93c1848..f9d90ad 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7523,6 +7523,8 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) } size = maybe_constant_value (size); + if (!TREE_CONSTANT (size)) + size = osize; } if (error_operand_p (size)) diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/array1.C b/gcc/testsuite/g++.dg/cpp0x/regress/array1.C new file mode 100644 index 0000000..629ab41 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/array1.C @@ -0,0 +1,16 @@ +// PR c++/47808 +// { dg-options -std=c++0x } + +template <typename T> +inline T abs (T const & x) { return x; } + +template <typename T> +void f (T) +{ + typedef int ai[(abs(0.1) > 0) ? 1 : -1]; +} + +int main() +{ + f(1); +}