microsoft / ifc-spec

IFC format specification
Creative Commons Attribution 4.0 International
71 stars 7 forks source link

Missing initializer of constant defined in template class #88

Open AndreyG opened 1 year ago

AndreyG commented 1 year ago

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?

GabrielDosReis commented 1 year ago

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 commented 1 year ago

https://developercommunity.visualstudio.com/t/IFC-missing-initializer-of-constant-de/10362197

GabrielDosReis commented 1 year ago

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

AndreyG commented 1 year ago

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