Skip to content

Commit

Permalink
Merge pull request #1106 from 9rnsr/fix8629
Browse files Browse the repository at this point in the history
Issue 8629 - UFCS resolution prints fake error
  • Loading branch information
Don Clugston committed Sep 10, 2012
2 parents 475178e + cc4598a commit caf2891
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/expression.c
Expand Up @@ -10250,8 +10250,9 @@ Expression *AssignExp::semantic(Scope *sc)
if (e1->op == TOKdotti)
{
DotTemplateInstanceExp *dti = (DotTemplateInstanceExp *)e1;
int olderrors = global.errors;
dti->e1 = dti->e1->semantic(sc);
if (!global.errors && dti->e1->type)
if (global.errors == olderrors && dti->e1->type)
{
unsigned errors = global.startGagging();
e1 = dti->semantic(sc, 1);
Expand All @@ -10264,8 +10265,9 @@ Expression *AssignExp::semantic(Scope *sc)
else if (e1->op == TOKdot)
{
DotIdExp *die = (DotIdExp *)e1;
int olderrors = global.errors;
die->e1 = die->e1->semantic(sc);
if (!global.errors && die->e1->type)
if (global.errors == olderrors && die->e1->type)
{
unsigned errors = global.startGagging();
e1 = die->semantic(sc, 1);
Expand Down
20 changes: 20 additions & 0 deletions test/fail_compilation/diag8629.d
@@ -0,0 +1,20 @@
// REQUIRED_ARGS: -property
/*
TEST_OUTPUT:
---
fail_compilation/diag8629.d(9): Error: not a property s.gunc
---
*/

#line 1
struct S {}

auto gunc(S s, int n) { return 13; }
@property grop(S s, int n) { return 14; }

void main()
{
S s;
assert((s.gunc = 1) == 13); // line 9
assert((s.grop = 1) == 14); // line 10
}

0 comments on commit caf2891

Please sign in to comment.