Skip to content

False positive for bugprone-crtp-constructor-accessibility #131737

@kone-tlammi

Description

@kone-tlammi
$ clang-tidy --version
LLVM (http://llvm.org/):
  LLVM version 19.1.7
  Optimized build.

Snippet

template <class T>
class Base {
  friend T;
  Base() = default;

 public:
  Base(const Base&) = delete;
  Base& operator=(const Base&) = delete;

  Base(Base&&) = delete;
  Base& operator=(Base&&) = delete;

  ~Base() = default;
};

class Foo : public Base<Foo> {};

produces

warning: public contructor allows the CRTP to be constructed as a regular template class; consider making it private [bugprone-crtp-constructor-accessibility]

for the deleted copy and move constructors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions