Skip to content

misc-include-cleaner false positive when ADL finds a function at 2nd phase of two-phase name lookup #116517

Open
@geza-herman

Description

@geza-herman

For this 4-file setup, clang-tidy reports that bar.hpp is unused in main.cpp. But this is incorrect, it is necessary for the example to compile.

// main.cpp
#include "call_bar.hpp"
#include "bar.hpp"
#include "base.hpp"

int main() {
    return call_bar(Base());
}
// call_bar.hpp
#ifndef CALL_BAR_HPP
#define CALL_BAR_HPP

template <typename T>
int call_bar(T t) {
    return bar(t);
}

#endif
// bar.hpp
#ifndef BAR_HPP
#define BAR_HPP

#include "base.hpp"

int bar(Base) {
    return 0;
}

#endif
// base.hpp
#ifndef BASE_HPP
#define BASE_HPP

struct Base {};

#endif

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions