[Potential Bug] [MSVC] Exporting views from a module causes error unless the importer also includes the view's headers #1734
Unanswered
alessiocali
asked this question in
Q&A
Replies: 1 comment
-
Might be related to #1595 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! Please forgive me if this turns out to be an MSVC bug, or a module bug (I know modules are still somewhat experimental). I'm at my wits ends and I would like to ask the community for guidance.
So in my pet project (which is built using C++20 modules) I'm wrapping range-v3 in some commodity classes that I plan to use to have a controlled interface. The problem is that whenever I try to use the iterator from range-v3 to iterate over my wrapper class I start getting all sorts of compilation error.
My exact example is much more complex than this but it gives a generic compiler error from MSVC which is not very useful. Instead here is a very stripped down example where I try to directly return the range-v3 view.
Compile with
Gets me the following output
From a cursory glance it seems like a failed import. In theory,
#include
-ing a header in the global module unit should make it visible to the importer, and in fact I did a few experiments where I did exactly that and it worked fine. But in the case of Range-V3 something seems to go amiss. In fact, just adding#include <range/v3/view/transform.hpp>
tomain.cpp
is enough to make the compilation succeed and get me the output I want.Thoughts? Suggestions? Should I just forward this to the Visual Studio team?
Beta Was this translation helpful? Give feedback.
All reactions