Skip to content

CFE does not report an error when new is used in a non-constructor position with constructor tearoffs enabled #47075

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

Closed
leafpetersen opened this issue Sep 1, 2021 · 2 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@leafpetersen
Copy link
Member

With constructor tearoffs enabled, the CFE correctly emits an error on the definition of the field in C in the code below, but issues no errors on the access of new on an instance of C and on foo in main. I believe that all of those should be an error. This causes a failure in co19/Language/Expressions/Instance_Creation/New/type_t05 (source here) when constructor tearoffs are enabled. See logs here . CL turning on the flag is here.

cc @eernstg @lrhn @johnniwinther @devoncarew

class C {
  int new = 42;
}

main() {
  new C().new is int;
  dynamic foo;
  foo.new;
  foo.new();
}
@leafpetersen leafpetersen added the legacy-area-front-end Legacy: Use area-dart-model instead. label Sep 1, 2021
@johnniwinther johnniwinther self-assigned this Sep 2, 2021
@eernstg
Copy link
Member

eernstg commented Sep 2, 2021

Same situation as #47077.

@leafpetersen
Copy link
Member Author

I still see no errors on the first line of main (see here for the failing test).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

3 participants