Skip to content

Compilation Error in unexpected<E> comparison #18

@Willaaaaaaa

Description

@Willaaaaaaa

Description

Hi, I am in the process of packaging your library to xmake-repo to make it easily accessible to more developers.

During this process, the automated CI detected build failures on 7 configurations, primarily on mingw and some Linux environments (Archlinux, Fedora). You can see the complete CI log and relevant discussion here.

Reproduce

This issue can be reproduced by running the whole repo in a mingw environment.
I personally prefer and use xmake. Of course, I believe that after some steps, you can also reproduce this with cmake. You can use whatever you want.

set_project("zeus_expected")
set_version("1.3.0")

add_rules("mode.debug", "mode.release")
add_requires("catch2", {system = false})

target("zeus_expected")
    set_kind("headeronly")
    add_includedirs("include", {public = true})

for _, std in ipairs({"17", "20", "23"}) do
    target("test_expected_cpp" .. std)
        set_kind("binary")
        set_group("tests")

        set_languages("cxx" .. std)
        add_files("tests/test_expected/*.cpp")

        add_packages("catch2")
        add_deps("zeus_expected")
end

xmake f -p mingw --sdk=E:\msys64\mingw64
xmake run

Then you can get the error:

Image

Possible Solution

I have limited capacity to debug the exact compiler issue, but the error obviously points to the friend operator== and != being unable to access the private member m_val. So, I would suggest using the error() function to get m_val avoiding this.

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