Skip to content

Commit

Permalink
Add test for this fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
H. S. Teoh committed Jul 14, 2014
1 parent d615255 commit 311937f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/fail_compilation/fail13116.d
@@ -0,0 +1,29 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail13116.d(13): Error: this is not an lvalue
---
*/
struct S
{
ref S notEvil() { return this; } // this should be accepted
}
class C
{
ref C evil() { return this; } // this should be rejected
}
void main()
{
}

/*
TEST_OUTPUT:
---
fail_compilation/fail13116.d(28): Error: super is not an lvalue
---
*/
class Base { }
class Derived : Base
{
ref Base evil() { return super; } // should be rejected
}

0 comments on commit 311937f

Please sign in to comment.