Closed cpreh closed 4 years ago
Thanks for reporting, looks like we have yet another MSVC regression :disappointed:
MSVC is notoriously terrible at handling templates correctly and working around its bugs is very frustrating, as it essentially boils down to trial an error rewriting perfectly valid code until it passes on that particular build of MSVC. To make things worse, the only means I personally have available at the moment to test Metal on MSVC is through appveyor and the ridiculous turn around time just makes it an impractical tool to use for this purpose.
Would it be reasonable for you to downgrate your installation of MSVC to 19.16.27034, which is known to support Metal?
I know that MSVC has been difficult to deal with when writing heavy template code (I have experienced this myself a lot of times, unfortunately). I will try to use an older version once I figure out how to do this with CMake.
As I'm writing libraries myself, I would really like to support the latest versions of all major compilers if possible. Both error messages look very similar and a simple workaround might fix both of them. Unfortunately, I know very little of metal's implementation. I'd be glad if you could think of a possible workaround I could try.
I did a bit of testing. The most recent version that still seems to work is 19.22. 19.23 has the same problem as 19.24.
Thanks for investigating this further, I opened #126 to try and fix this issue, but I confess I'm still shooting in the dark at this point.
Finally managed to reproduce the issue using github actions instead of Appveyor.
I've created an issue at Microsofts bugtracker: https://developercommunity.visualstudio.com/content/problem/898441/regression-1922-1924-the-c-tmp-library-metal-fails.html
Thank you. Hopefully this gets resolved soon. If there is any chance anyone can think of a workaround, I would also appreciate it.
Finally found a workaround, see #127.
Thank you. I can confirm that all of my code that uses metal now builds fine with VC++ 19.24.
Thanks for testing!
Just including metal.hpp results in a few errors with VC++ 19.24. I created an empty project and changed none of the settings except for adding an additional include directory for metal.hpp. The file I tested this with is the one from https://raw.githubusercontent.com/brunocodutra/metal/standalone/metal.hpp. I also tried to include metal.hpp from the include directory of the source tree, which resulted in the same errors.
Source code:
include
int main() {}
Build log:
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3113,1): error C3527: 'intmax_t' is not a valid operand for 'sizeof...'. Did you mean to use 'sizeof'? 1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3113): message : see reference to alias template instantiation 'metal::join<caller<detail::if<std::integralconstant<metal::detail::int,vs>>::type,metal::list<x,y,t>...,metal::list...>::type...>' being compiled
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3114): message : see reference to class template instantiation 'metal::detail::_replace_if<metal::list,metal::list<std::integralconstant<metal::detail::int,vs>...>,x,y,t...>' being compiled
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3113,1): error C2938: 'metal::join' : Failed to specialize alias template
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3121,1): error C3527: 'intmax_t' is not a valid operand for 'sizeof...'. Did you mean to use 'sizeof'?
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3121): message : see reference to alias template instantiation 'metal::join<caller<detail::if<std::integralconstant<metal::detail::int,vs>>::type,metal::list<>,metal::list...>::type...>' being compiled
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3122): message : see reference to class template instantiation 'metal::detail::_replace_if<metal::list,metal::list<std::integralconstant<metal::detail::int,vs>...>,>' being compiled
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(3121,1): error C2938: 'metal::join' : Failed to specialize alias template
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(4142,1): error C3527: 'intmax_t' is not a valid operand for 'sizeof...'. Did you mean to use 'sizeof'?
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(4142): message : see reference to alias template instantiation 'metal::join<caller<detail::if<std::integralconstant<metal::detail::int,vs>>::type,metal::list...,metal::list<>>::type...>' being compiled
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(4143): message : see reference to class template instantiation 'metal::detail::_find_index<metal::list<std::integralconstant<metal::detail::int,vs>...>,metal::list>' being compiled
1>C:\Users\Philipp\Documents\libs\metal-standalone\metal.hpp(4142,1): error C2938: 'metal::join' : Failed to specialize alias template
1>Done building project "TestProject.vcxproj" -- FAILED.