Describe the bug
I am using MSVC compiler option /we to treat warning C5038 - out-of-order initialization of members - as an error.
The C++ code generator of a WinUI 3 project generates constructors for XamlUserType and XamlMember with members initialized out-of-order, so my project fails to compile.
Irrespective of my specific compiler settings the generator should emit correct code.
1> XamlTypeInfo.Impl.g.cpp
1>\Generated Files\XamlTypeInfo.Impl.g.cpp(308,15): error C5038: data member 'winrt::Lozenge::implementation::XamlUserType::_fullName' will be initialized after data member 'winrt::Lozenge::implementation::XamlUserType::_baseType'
1> (compiling source file '/Generated%20Files/XamlTypeInfo.Impl.g.cpp')
1>\Generated Files\XamlTypeInfo.Impl.g.cpp(575,15): error C5038: data member 'winrt::Lozenge::implementation::XamlMember::_provider' will be initialized after data member 'winrt::Lozenge::implementation::XamlMember::_name'
1> (compiling source file '/Generated%20Files/XamlTypeInfo.Impl.g.cpp')
Steps to reproduce the bug
- Create a new C++ project from template "WinUI Blank App (Packaged)"
- Edit project properties -> Configuration Properties -> C/C++ -> Advanced -> Treat Specific Warnings As Error -> 5038 (also see screenshot);
Alternatively set the warning level for this error as an Additional Option: /w1"5038".
- Build
- Observe the reported error (or warning).
Expected behavior
XamlTypeInfo.Impl.g.cpp should compile without warnings or errors.
Irrespective of my specific compiler settings the generator should emit correct code.
Screenshots
NuGet package version
1.8.251003001, 2.0.1
Packaging type
Unpackaged, Packaged (MSIX)
Windows version
Windows 11 version 24H2 (26100, June 2025 Update)
IDE
Visual Studio 2022, Other
Additional context
No response
Describe the bug
I am using MSVC compiler option
/weto treat warningC5038- out-of-order initialization of members - as an error.The C++ code generator of a WinUI 3 project generates constructors for
XamlUserTypeandXamlMemberwith members initialized out-of-order, so my project fails to compile.Irrespective of my specific compiler settings the generator should emit correct code.
Steps to reproduce the bug
Alternatively set the warning level for this error as an Additional Option:
/w1"5038".Expected behavior
XamlTypeInfo.Impl.g.cppshould compile without warnings or errors.Irrespective of my specific compiler settings the generator should emit correct code.
Screenshots
NuGet package version
1.8.251003001, 2.0.1
Packaging type
Unpackaged, Packaged (MSIX)
Windows version
Windows 11 version 24H2 (26100, June 2025 Update)
IDE
Visual Studio 2022, Other
Additional context
No response