Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error message when returning 'this' by reference from class member #17707

Closed
akarpov89 opened this issue Mar 10, 2017 · 2 comments
Closed

Comments

@akarpov89
Copy link

Version Used:
Master branch @ March 9
Steps to Reproduce:

Compile the following code:

class C {
    ref C M() => ref this;   
}

Expected Behavior:
The compiler emits error "Class members cannot return 'this' by reference".

Actual Behavior:
The compiler emits error "Struct members cannot return 'this' or other instance members by reference"

@akarpov89
Copy link
Author

It is also possible to use message "Cannot return 'this' by reference" without specifying if the member belongs to class or struct.

@alrz
Copy link
Member

alrz commented Mar 10, 2017

Dup of #15704 and already has a fix here: #15706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants