rttr icon indicating copy to clipboard operation
rttr copied to clipboard

VS2017 15.3 emits C7510 with /permissive- (use of dependent template name must be prefixed with 'template')

Open JayhawkZombie opened this issue 7 years ago • 10 comments

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 avatar Aug 25 '18 22:08 JayhawkZombie

@JayhawkZombie Please provide a PR to fix the issue

acki-m avatar Sep 11 '18 19:09 acki-m

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

vamidi avatar Sep 11 '18 20:09 vamidi

Sorry, I didn’t see the responses. I will open a pull request soon that fixes the issue.

JayhawkZombie avatar Sep 18 '18 19:09 JayhawkZombie

Sure thing no problem!

vamidi avatar Sep 18 '18 19:09 vamidi

@JayhawkZombie with 15.8.5 I don't get any of these errors. Is a PR still needed?

acki-m avatar Sep 26 '18 19:09 acki-m

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.

Vennor avatar Dec 29 '18 17:12 Vennor

I believe this issue is resolved with PR https://github.com/rttrorg/rttr/pull/216 merged in, could you verify?

CosmicRey avatar Jan 21 '19 21:01 CosmicRey

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.

Vennor avatar Dec 02 '19 23:12 Vennor

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.

@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.

paulhazen avatar Oct 06 '20 18:10 paulhazen