Studio 12.6 started giving error for the code which compiled fine with 12.5
#include <type_traits>
template<typename>
struct Traits {
enum { IsA = false, IsB = false };
};
struct A1{};
struct A2{};
template<typename T>
class C {
// This is where Traits<T> gets instantiated
struct L: std::conditional<Traits<T>::isA || Traits<T>::isB, A1, A2>::type {};
};
struct D {
struct I {};
C<I> ci;
};
template<>
struct Traits<D::I> {
enum { isA = true, isB = false };
};
The error:
"test.cpp", line 23: Error: Template "Traits<D::I>" cannot be specialized after it was instantiated.
"test.cpp", line 23: Error: Invalid template nesting depth.
Is this a bug or a new interpretation of the standard?
Note that the error disappears when Traits is a forward declaration only before class C (template<typename> struct Traits;)