You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a template class without implementation, and a specialization where the actual implementation lives. As is also used for std::function. Include-what-you-use incorrectly suggests to add a forward declaration for the template class without implementation.
// static_function.test.cpp
#include<static_function.hpp>// unittests that use StaticFunction live here
IWYU output
[build] 3/4 Building CXX object tests/CMakeFiles/test_utils.dir/static_function.test.cpp.o
[build] Warning: include-what-you-use reported diagnostics:
[build]
[build] /home/glenn/projects/STM32F303-DISCOVERY/tests/static_function.test.cpp should add these lines:
[build] namespace util { template <typename TFunction, std::size_t StorageSize = sizeof(std::uintptr_t) * 3U> class StaticFunction; }
Note that the forward declaration suggested by IWYU not only does not make sense, it is also not valid C++ (because it contains the default template arguments).
Extra information
Tested with two IWYU versions
include-what-you-use 0.17 based on Ubuntu clang version 13.0.1-2ubuntu2.1
built from master against clang 16
The text was updated successfully, but these errors were encountered:
I can't reproduce on master (but none of the repro cases are really free-standing enough that I could test them without modification, so I can't say for sure if I'm trying the same thing). There's been a bunch of template improvements, so I'm going to close this as fixed. Please reopen with a reduced example if the problems persist.
Summary
I have a template class without implementation, and a specialization where the actual implementation lives. As is also used for
std::function
. Include-what-you-use incorrectly suggests to add a forward declaration for the template class without implementation.Source code
IWYU output
Note that the forward declaration suggested by IWYU not only does not make sense, it is also not valid C++ (because it contains the default template arguments).
Extra information
Tested with two IWYU versions
include-what-you-use 0.17 based on Ubuntu clang version 13.0.1-2ubuntu2.1
The text was updated successfully, but these errors were encountered: