Skip to content

Incorrect error reported for deleted function #134265

@ilovepi

Description

@ilovepi

Some time since 0454dd8 clang has started emitting an error for using a deleted function, except that function is not used.

struct Foo {
  virtual ~Foo() {}
  static void operator delete[](void* ptr) = delete;
};
<source>:2:11: error: attempt to use a deleted function
    2 |   virtual ~Foo() {}
      |           ^
<source>:3:15: note: 'operator delete[]' has been explicitly marked deleted here
    3 |   static void operator delete[](void* ptr) = delete;
      |               ^
1 error generated.
Compiler returned: 1

Godbolt: https://godbolt.org/z/aW31816h4

Surprisingly, this doesn't appear to manifest on godbolt w/ the assertions enabled, but in my local build (RelWithDebInfo + assertions) they do.

I'm bisecting now, but #133451 and #128866 seem like they could be related.

cc: @momo5502 @Fznamznon

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions