Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iwyu removes include required by variable template specialization #966

Open
tberghammer opened this issue Nov 4, 2021 · 1 comment · May be fixed by #1529
Open

iwyu removes include required by variable template specialization #966

tberghammer opened this issue Nov 4, 2021 · 1 comment · May be fixed by #1529

Comments

@tberghammer
Copy link

// a.h
template <typename A, typename B>
struct is_base_of {
    constexpr static bool value = __is_base_of(A, B);
};
template <class Base, class Derived>
inline constexpr bool is_base_of_v = is_base_of<Base, Derived>::value;

// b.cc
#include "a.h"

class Foo {};
template <typename T>
struct Bar {
    static const bool y = is_base_of_v<T, Foo>;
};
bool foo() { return Bar<Foo>::y; }
$ ./include-what-you-use b.cc -std=c++20
b.cc should add these lines:

b.cc should remove these lines:
- #include "a.h"  // lines 1-1

The full include-list for b.cc:
---

iwyu suggests that I remove the include for a.h even though is_base_of_v is only defined in a.h and it is clearly used in b.cc

@kimgr
Copy link
Contributor

kimgr commented Nov 10, 2021

-Xiwyu -v7 shows the presence of UnresolvedLookupExprs, which makes me think this is related to #636 and #823

bolshakov-a added a commit to bolshakov-a/include-what-you-use that referenced this issue Apr 23, 2024
See discussion in include-what-you-use#1525.

Besides, this fixes reporting ADL-found function declarations when all
the non-ADL declarations are in a single file. The corresponding test
case has been added to `overload_expr`.

Besides, this fixes include-what-you-use#966, include-what-you-use#792, include-what-you-use#1335, and include-what-you-use#1516.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants