提交 0fe5c11b 编写于 作者: M Marek Safar

[642975] Fix initializer of partially static multidimensional arrays

上级 6e5cb792
......@@ -5949,7 +5949,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) {
......@@ -6057,6 +6056,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.
先完成此消息的编辑!
想要评论请 注册