e-dant / watcher

Filesystem watcher. Works anywhere. Simple, efficient and friendly.
MIT License
639 stars 32 forks source link

compilation error on MSVC since 0.8.1 #31

Closed toge closed 1 year ago

toge commented 1 year ago

Since 0.8.1, MSVC 19.33 causes compile error. https://godbolt.org/z/qj6W84KP7

example.cpp
C:\Users\ContainerAdministrator\AppData\Local\Temp\compiler-explorer-compiler2023313-18468-1p7mtrd.iwwy\raw.githubusercontent.com/e-dant/watcher/release/0.8.3/include/wtr/watcher.hpp(191): error C3431: 'kind': a scoped enumeration cannot be redeclared as an unscoped enumeration
C:\Users\ContainerAdministrator\AppData\Local\Temp\compiler-explorer-compiler2023313-18468-1p7mtrd.iwwy\raw.githubusercontent.com/e-dant/watcher/release/0.8.3/include/wtr/watcher.hpp(177): error C3431: 'what': a scoped enumeration cannot be redeclared as an unscoped enumeration
Compiler returned: 2

I do not know the reason for this compile error. Is there any workaround?

e-dant commented 1 year ago

I'm sure! Apologies, I just saw this recently. Must have fallen off my notification filters.

I'll try to look into it soon, shouldn't be too much of an issue.

Thank you very much!

e-dant commented 1 year ago

Sorry for the delay, this was a tricky one.

https://godbolt.org/z/zv411vox3 at line 2400 was the trickiest error to find. Looks like MSVC has some difficulty knowing the difference between an enum and an enum class depending on its use, regardless of its declared type. What made it tricker was that being explicit about the type -- using enum class everywhere we make type aliases or define function arguments -- is a compiler error on gcc and clang... reference to enumeration must use 'enum' not 'enum class' [-Welaborated-enum-class]

Anyway, thank you! I'll keep this open if there are any other related issues down the pipeline.

toge commented 1 year ago

@e-dant Thanks a lot! 0.8.7 worked fine for me, all it passed the conan-center-index CI test and was published.