Skip to content

Specialization of 'std::formatter<winrt::Windows::Foundation::IStringable, wchar_t>' breaks with conformant compilers #1069

@dunhor

Description

@dunhor

E.g. when building with Clang 13 & the standard conformance flags, I see the error:

include\winrt/impl/Windows.Foundation.1.h(245,68): error: function 'ToString' with deduced return type cannot be used before it is defined
        return std::formatter<winrt::hstring, wchar_t>::format(obj.ToString(), fc);
                                                                   ^
include\winrt/impl/Windows.Foundation.0.h(864,34): note: 'ToString' declared here
        WINRT_IMPL_AUTO(hstring) ToString() const;

Seems that it's because the definition of consume_Windows_Foundation_IStringable<D>::ToString is defined in the "normal" winrt/Windows.Foundation.h header, but all of the winrt/impl/*.h files are included first, and one of these is the header trying to consume the function in question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions