rttr
rttr copied to clipboard
VS2017 15.3 emits C7510 with /permissive- (use of dependent template name must be prefixed with 'template')
MSVC 15.3 partially supports two-phase lookup, and now enforces the requirement that the use of dependent names must be prefixed with 'template'. Their implementation is not perfect, though, and will sometimes emit invalid errors
Only 1 file generated these errors, rttr/detail/registration/bind_impl.hpp
On lines 358, 388, 449, 477, 539, 566, 625, 678, 698, 778, and 783, the get in type::get<ClassType> can be prefixed with template, like type::template get<ClassType>, to silence the error.
From their article, it seems invalid errors are emitted with local non-type dependent expressions, but I'm not sure these would be a result of that compiler bug. In any case, I don't have other compilers to test the changes on. If it is only a VS2017 issue, then at least others who get the errors may see this and have the changes needed to fix the errors.
@JayhawkZombie Please provide a PR to fix the issue
on Visual studio 15.8.3, I got the same error on all those lines as well adding type::template get<ClassType> indeed fixes the error
Sorry, I didn’t see the responses. I will open a pull request soon that fixes the issue.
Sure thing no problem!
@JayhawkZombie with 15.8.5 I don't get any of these errors. Is a PR still needed?
This still happens for me on 15.9.4 with /permissive- and two-phase lookup turned on, but this time it's only tied do type::get calls. Should I fix it?
Edit: turns out I'm using 0.9.5-3 since that's what's currently available on vcpkg.
I believe this issue is resolved with PR https://github.com/rttrorg/rttr/pull/216 merged in, could you verify?
To begin with I apologise for taking a long time on this. At the moment this still happens on VS 16.3.9 and rttr 0.9.6-1. Nevertheless, I see that the current master bind_impl.hpp already has greatly reduced type::get call count and the remaining ones are properly decorated with the template keyword, so I assume a fix is coming in the next release.
On lines 358, 388, 449, 477, 539, 566, 625, 678, 698, 778, and 783, the
getintype::get<ClassType>can be prefixed withtemplate, liketype::template get<ClassType>, to silence the error.
@JayhawkZombie - Silencing the error in this manner causes very hard to track down problems: See my closed issue #292. Putting this note here in case anybody makes the same mistake as I did.