Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix Issue 6708 - immutable ref implicit cast to const ref #1496

Merged
merged 1 commit into from

2 participants

@WalterBright WalterBright merged commit 685d943 into D-Programming-Language:master
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 2 deletions.
  1. +2 −2 src/expression.c
  2. +8 −0 test/runnable/xtest46.d
View
4 src/expression.c
@@ -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
8 test/runnable/xtest46.d
@@ -3520,6 +3520,14 @@ void test156()
}
/***************************************************/
+
+void test6708(const ref int y)
+{
+ immutable int x;
+ test6708(x);
+}
+
+/***************************************************/
// 4258
struct Vec4258 {
Something went wrong with that request. Please try again.