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

Workaround for compilation failure on MSVC #30

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Workaround for compilation failure on MSVC #30

merged 1 commit into from
Nov 14, 2024

Conversation

ednolan
Copy link
Member

@ednolan ednolan commented Nov 14, 2024

This commit depends on
#27.

There is implementation divergence as to whether the following code is
accepted:

template <typename T>
struct foo {
    static constexpr auto baz() {
        return 0;
    }
    using quux = decltype(baz);
};

It is accepted by GCC and Clang, and rejected by MSVC and sometimes
by EDG: https://godbolt.org/z/dW964rqec

Because the calculation of the iterator_category depended on code of
this form, previously, MSVC would fail to compile iterator_interface
with this error:

error C3539: a template-argument cannot be a type that contains 'auto'

In order to work around this issue, the static member function-based
metaprogramming has been replaced with the use of std::conditional_t.

After this change, MSVC successfully compiles and runs all the tests.

This commit depends on
#27.

There is implementation divergence as to whether the following code is
accepted:

template <typename T>
struct foo {
    static constexpr auto baz() {
        return 0;
    }
    using quux = decltype(baz);
};

It is accepted by GCC and Clang, and rejected by MSVC and sometimes
by EDG: https://godbolt.org/z/dW964rqec

Because the calculation of the iterator_category depended on code of
this form, previously, MSVC would fail to compile iterator_interface
with this error:

error C3539: a template-argument cannot be a type that contains 'auto'

In order to work around this issue, the static member function-based
metaprogramming has been replaced with the use of std::conditional_t.

After this change, MSVC successfully compiles and runs all the tests.
@ednolan ednolan merged commit 94adc3e into bemanproject:main Nov 14, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

3 participants