提交 d8034534 编写于 作者: M Marek Safar 提交者: Miguel de Icaza

[642975] Fix initializer of partially static multidimensional arrays

上级 b49c845d
......@@ -5833,7 +5833,6 @@ namespace Mono.CSharp {
if (initializers == null)
return true;
only_constant_initializers = true;
for (int i = 0; i < probe.Count; ++i) {
var o = probe [i];
if (o is ArrayInitializer) {
......@@ -5941,6 +5940,8 @@ namespace Mono.CSharp {
protected bool ResolveInitializers (ResolveContext ec)
{
only_constant_initializers = true;
if (arguments != null) {
bool res = true;
for (int i = 0; i < arguments.Count; ++i) {
......
// Compiler options: -optimize
using System;
class Test
{
static int Main ()
{
//switching to a constant fixes the problem
double thisIsCausingTheProblem = 5.0;
double[,] m1 = new double[4, 4] {
{ 1.0, 0.0, 0.0, thisIsCausingTheProblem },
{ 0.0, 1.0, 0.0, thisIsCausingTheProblem },
{ 0.0, 0.0, 1.0, thisIsCausingTheProblem },
{ 0.0, 0.0, 0.0, 1.0 }
};
var r = m1[0, 3];
if (r != 5)
return 1;
return 0;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册