xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

fix template disambiguation syntax on MSVC

Open PerretB opened this issue 1 year ago • 5 comments

MSCV currently emits a syntax error on line (TBB with SIMD branch) https://github.com/xtensor-stack/xtensor/blob/8c0a484f04eccd0dbc0e25eb58a97de000fb048b/include/xtensor/xassign.hpp#L1252

Adds a simple syntax helper for MSVC (not sure what the standard says here).

res_stepper.template store_simd<>(fct_stepper.template step_simd<value_type>()); 

FIXES #2736 (note that compiling with /Zc:lambda on MSVC is currently required to avoid this compiler bug https://developercommunity.visualstudio.com/t/lambda-fails-to-implicitly-capture-constexpr-value/610504 )

PerretB avatar Jul 22 '24 10:07 PerretB

I've been wondering how to fix this. The default lambda parser is definitely not compliant with constexpr captures. How did you know that adding <> would fix this?

spectre-ns avatar Jul 24 '24 00:07 spectre-ns

I had a vague memory of having encountered a similar problem with the template keyword before, but I can't say I knew it would work :D

PerretB avatar Jul 24 '24 21:07 PerretB

Thanks! This will help my code base.

@JohanMabille please review! 🙂

spectre-ns avatar Jul 24 '24 21:07 spectre-ns

Hi, Line 1177 has the same .template usage. For my project this change solved the error.

brccabral avatar Sep 26 '24 02:09 brccabral

ping @JohanMabille, this is also solving issues in my downstream projects

adriendelsalle avatar Feb 19 '25 12:02 adriendelsalle