Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Weird c++20 MainWindow.xaml.g.hpp bug #1421

Closed
tom-huntington opened this issue Jun 13, 2024 · 1 comment
Closed

Bug: Weird c++20 MainWindow.xaml.g.hpp bug #1421

tom-huntington opened this issue Jun 13, 2024 · 1 comment

Comments

@tom-huntington
Copy link

tom-huntington commented Jun 13, 2024

Version

2.0.230706.1

Summary

The Xaml compiler generates code that calls winrt::Windows::Foundation::IReference<bool>::Value microsoft/microsoft-ui-xaml#9214.

If you force the instantiation of winrt::Windows::Foundation::IReference<bool>::Value there is no problem.

Otherwise, you get the classic a function that returns 'auto' cannot be used before it is defined error even though the header is properly included.

Feel free to close it seems like a msvc bug since in only happens on /std:c++20, I just though you might want to know.

Reproducible example

https://github.com/tom-huntington/auto-bool-visibility-conversion-cpp20-regression

//MainWindow.xaml.h
#if 1
inline void force_instantiation_of_IRefBoolValue()
{
    &winrt::Windows::Foundation::IReference<bool>::Value;
}
#else
//error C3779 : 'winrt::impl::consume_Windows_Foundation_IReference<winrt::Windows::Foundation::IReference<bool>,T>::Value' : a function that returns 'auto' cannot be used before it is defined
#endif
@kennykerr
Copy link
Collaborator

Thanks, if you think this is a compiler bug your best bet is to report a problem here:

https://developercommunity.visualstudio.com/cpp

For Xaml-related issues you're better off engaging directly with the Xaml team here:

https://github.com/microsoft/microsoft-ui-xaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants