microsoft/ifc-spec

Missing initializer of constant defined in template class

AndreyG opened this issue · 4 comments

Let's consider the following module:

constexpr bool global = true;

struct A {
	static constexpr bool static_field = true;
};

template<typename> struct B {
	static constexpr bool primary_template = true;
};

template<typename T> struct B<T*> {
	static constexpr bool partial_spec = true;
};

template<> struct B<void> {
	static constexpr bool explicit_spec = true;
};

Partition decl.variable contains 5 elements, 3 of them have initializer, but for variables primary_template and partial_spec initializer is null. I understand that it's impossible to evaluate value of variable inside template, because it could be dependent expression, but shouldn't be initializer somehow preserved in IFC?

I agree. This looks like an MSVC bug. Could you, please file a bug on Microsoft's Developer Community portal against MSVC and provide the link here?

@AndreyG - is this still an issue? The DevCom issue says that it cannot be reproduced. Could you confirm that you can still reproduce this issue?

@GabrielDosReis, yes, this is still the issue. I have rechecked it 10 minutes ago with the latest publicly available compiler 19.37.32820.0 (2022\Preview\VC\Tools\MSVC\14.37.32820). I'm sorry to say, but it is clear for me that people from DevCom did not even bother to check.