World::each causes Internal compiler error if class has an implementation file #5
Comments
I am unable to reproduce said issue in VS2017. C1001 indicates an internal compiler error, can you post the full error message? It may have to do with what optimization settings you are using. Alternatively, zip the entire project and post it here (or email it to me at sam at xbloom dot io). An implementation file being present is likely to be a red herring, by the way. Header files are not compiled unless included by an implementation file (unless you change the default settings). |
Side-note: Unless you have some requirements I do not know about, I suggest making |
This is an empty project containing just ECS.h and a test class demonstrating the issue, for me this project fails to compile, take a look: There is nothing more to the error message than just "Internal compiler error". From Stackoverflow, it seems like this error is not "supposed to appear" and should be reported to Microsoft as a bug in the VC++ compiler. It might just be one but i was wondering if you ever encountered this or if it recently popped up.
Usually im using your classes how they're supposed to be used :) Was just trying to make the example as short as possible |
I'm still unable to reproduce the issue, even using your project files. It's possible I'm running a different version of the compiler (VS 15.4.1, not sure the exact compiler version) but unfortunately I can't upgrade on this machine. It's also possible that you have some setting set somewhere that changes things just enough as to trigger this error since it sounds like you might have actually hit a bug in the compiler. The best I can find is that there are some newer optimizations that might be breaking something in the compiler. Try rewriting things to be slightly different (but in effect make them do the same thing). Change the type of variables (i.e. use float or uint16_t instead of int) and see what happens, try adding code before/after the call to Maybe try the other overload for |
Huh, then this might have been just introduced in one of the last couple of updates. I have tried changing things quite a bit, this issue originally popped up in a much bigger class, the method looks something like this: void RenderingCore::render(ECS::World* world)
{
m_display->clear();
m_pbrShader->use();
m_pbrShader->updateCamera(*m_camera);
using namespace ECS;
world->each<Transform, Model>([&](Entity* ent, ComponentHandle<Transform> transform, ComponentHandle<Model> model) {
m_pbrShader->setTransform(transform.get());
model->draw();
});
m_cubemap->render(*m_camera);
m_display->update();
} where |
Odd. I'll see if I can update my compiler tomorrow and repro this. At the very least, we might have a bug report for the MSVC team.
|
I'll wait for your reproduction first, i find it more likely that my machine / VS install is somehow broken than this actually being a VC++ bug. |
That's always possible. You might want to see if a clean install fixes it.
|
I just tested the demo project on a different machine, also with VS 15.5.7, and i get the same error. |
Looks like it isn't just you. VS 15.5.7 gives me the same issue. I guess it's a bug in the compiler introduced in 15.5. |
Looks like adding the
|
This instead gives me a linker error |
It might be. Looks like they have a process to do so here: https://docs.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio-2017
|
The bug report has been answered, and i can confirm that it works in the 15.6 preview! |
Great! |
This header file compiles and works perfectly:
however, as soon as an implementation file is present, for example
TestClass.cpp
, even if it just containsVisual Studio shows an internal compiler error (C1001) at the last line of the implementation file. This error remains whatever i do, using
inline
, moving the implementation to the .cpp file and so on.Im running the latest Visual Studio enterprise 2017, v. 15.5.7
The text was updated successfully, but these errors were encountered: