Thanks to visit codestin.com
Credit goes to github.com

Skip to content

False positive for runtime/explicit on deleted constructors #386

@ptomato

Description

@ptomato

Deleted constructors shouldn't need to be marked explicit, because they can't be called implicitly.

Test case: explicit.cpp

// Copyright 2025 The Public Domain
class A {};

class B {
  B(A) = delete;
};

Actual output:

$ cpplint --version
Cpplint fork (https://github.com/cpplint/cpplint)
cpplint 2.0.2
Python 3.13.5 (main, Jun 12 2025, 00:00:00) [GCC 15.1.1 20250521 (Red Hat 15.1.1-2)]
$ cpplint explicit.cpp
explicit.cpp:5:  Single-parameter constructors should be marked explicit.  [runtime/explicit] [4]
Done processing explicit.cpp
Total errors found: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions