Issue 115037
Summary Pure virtual destructors (`virtual ~class() = 0;`) should not trigger `warning: class 'Class' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions,hicpp-special-member-functions]`
Labels new issue
Assignees
Reporter SwuduSusuwu
    ```
$ cat Class.hxx
class Class {
 public:
  virtual ~Class() = 0;
};
$ cat .clang-tidy
---
Checks: '*'
$ clang-tidy Class.hxx
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "class.hxx"
No compilation database found in /data/data/com.termux/files/home/SubStack or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
2 warnings generated.
/data/data/com.termux/files/home/SubStack/Class.hxx:1:7: warning: class 'Class' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions,hicpp-special-member-functions]
 1 | class Class {
      |       ^
```
Pure virtual functions cannot have constructors, thus `clang-tidy` should not warn that a pure virtual destructor has no constructor to go along.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to