Question Details

No question body available.

Tags

c++ visual-c++

Answers (1)

Accepted Answer Available
Accepted Answer
July 4, 2026 Score: 2 Rep: 51,054 Quality: High Completeness: 80%

This is definitely a msvc bug as msvc accepts the variable form auto &F = F::f of the same but rejects when auto is used in for NTTP case since as per the standard the auto in NTTP case is equivalent to(not same) writing the variable declaration form as per the standard. This can be seen from [temp.arg.nontype]:

If the type T of a template-parameter (13.2) contains a placeholder type (9.2.9.6) or a placeholder for a deduced class type (9.2.9.7), the type of the parameter is the type deduced for the variable x in the invented declaration

T x = template-argument ;

If a deduced parameter type is not permitted for a template-parameter declaration (13.2), the program is ill-formed.


Here is the newly submitted msvc bug:

https://developercommunity.visualstudio.com/t/MSVC-rejects-valid-template-non-type-arg/11116775