Skip to content

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

Closed
@leafpetersen

Description

@leafpetersen

With constructor tearoffs enabled, the analyzer 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 should cause a failure in co19/Language/Expressions/Instance_Creation/New/type_t05 (source here) when constructor tearoffs are enabled. See logs here but note that the analyzer run failed with an infrastructure issue . CL turning on the flag is here.

cc @eernstg @lrhn @srawlins @scheglov @devoncarew

class C {
  int new = 42;
}

main() {
  new C().new is int;
  dynamic foo;
  foo.new;
  foo.new();
}

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions