Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[Regression 2.061] Issue 9410 - Wrong selection for function overload #1571

Merged
merged 1 commit into from

2 participants

@WalterBright WalterBright merged commit e7d4abc 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
Commits on Jan 28, 2013
  1. @9rnsr
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 34 deletions.
  1. +0 −19 src/mtype.c
  2. +1 −15 src/template.c
  3. +14 −0 test/runnable/overload.d
View
19 src/mtype.c
@@ -6081,25 +6081,6 @@ MATCH TypeFunction::callMatch(Expression *ethis, Expressions *args, int flag)
new IntegerExp(0, ((StringExp *)arg)->len,
Type::tindex));
}
- else if (ta && ta->implicitConvTo(tprm))
- {
- goto Nomatch;
- }
- else if (arg->op == TOKstructliteral)
- {
- match = MATCHconvert;
- }
- else if (arg->op == TOKcall)
- {
- CallExp *ce = (CallExp *)arg;
- if (ce->e1->op == TOKdotvar &&
- ((DotVarExp *)ce->e1)->var->isCtorDeclaration())
- {
- match = MATCHconvert;
- }
- else
- goto Nomatch;
- }
else
goto Nomatch;
}
View
16 src/template.c
@@ -1588,21 +1588,7 @@ MATCH TemplateDeclaration::deduceFunctionTemplateMatch(Scope *sc, Loc loc, Objec
if (m && (fparam->storageClass & (STCref | STCauto)) == STCref)
{ if (!farg->isLvalue())
{
- if (farg->op == TOKstructliteral)
- m = MATCHconvert;
- else if (farg->op == TOKcall)
- {
- CallExp *ce = (CallExp *)farg;
- if (ce->e1->op == TOKdotvar &&
- ((DotVarExp *)ce->e1)->var->isCtorDeclaration())
- {
- m = MATCHconvert;
- }
- else
- goto Lnomatch;
- }
- else
- goto Lnomatch;
+ goto Lnomatch;
}
}
if (m && (fparam->storageClass & STCout))
View
14 test/runnable/overload.d
@@ -95,12 +95,26 @@ void test8943()
}
/***************************************************/
+// 9410
+
+struct S {}
+int foo(float f, ref S s) { return 1; }
+int foo(float f, S s) { return 2; }
+void test9410()
+{
+ S s;
+ assert(foo(1, s ) == 1); // works fine. Print: ref
+ assert(foo(1, S()) == 2); // Fails with: Error: S() is not an lvalue
+}
+
+/***************************************************/
int main()
{
test7418();
test7552();
test8943();
+ test9410();
printf("Success\n");
return 0;
Something went wrong with that request. Please try again.