Permalink
Browse files

Fix Issue 6708 - immutable ref implicit cast to const ref

  • Loading branch information...
yebblies committed Jan 16, 2013
1 parent 4c52f07 commit 704240e0d391cbf76f45d4d5e8e2a87454494e11
Showing with 10 additions and 2 deletions.
  1. +2 −2 src/expression.c
  2. +8 −0 test/runnable/xtest46.d
View
@@ -1137,7 +1137,7 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf,
if (p->type->hasWild())
{
arg = arg->implicitCastTo(sc, p->type->substWildTo(wildmatch));
- arg = arg->optimize(WANTvalue);
+ arg = arg->optimize(WANTvalue, p->storageClass & STCref);
}
else if (p->type != arg->type)
{
@@ -1149,7 +1149,7 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf,
}
else
arg = arg->implicitCastTo(sc, p->type);
- arg = arg->optimize(WANTvalue);
+ arg = arg->optimize(WANTvalue, p->storageClass & STCref);
}
}
if (p->storageClass & STCref)
View
@@ -3519,6 +3519,14 @@ void test156()
assert(cs.g() == 2);
}
+/***************************************************/
+
+void test6708(const ref int y)
+{
+ immutable int x;
+ test6708(x);
+}
+
/***************************************************/
// 4258

0 comments on commit 704240e

Please sign in to comment.