Permalink
Browse files

Merge pull request #1496 from yebblies/issue6708

Fix Issue 6708 - immutable ref implicit cast to const ref
  • Loading branch information...
2 parents 4f08b86 + 704240e commit 685d943a3af777621476239e200d895c6d375490 @WalterBright WalterBright committed Jan 18, 2013
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)
@@ -3520,6 +3520,14 @@ void test156()
}
/***************************************************/
+
+void test6708(const ref int y)
+{
+ immutable int x;
+ test6708(x);
+}
+
+/***************************************************/
// 4258
struct Vec4258 {

0 comments on commit 685d943

Please sign in to comment.