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

Using nameof_member on a rhs of member copy initialization fails to compile on MSVC #46

Closed
kamchatka-volcano opened this issue Oct 30, 2022 · 1 comment

Comments

@kamchatka-volcano
Copy link
Contributor

Hello, the following code snippet doesn't compile on MSVC (2022), but works fine with clang and gcc:

struct TestStruct{
    std::string teststringfield = std::string{nameof::nameof_member<&TestStruct::teststringfield>()};
};

auto test = TestStruct{};
REQUIRE(test.teststringfield == "teststringfield");
@schaumb
Copy link
Contributor

schaumb commented Nov 12, 2022

Hi.

The problem is that MSVC cannot find the destructor of the inside used union. This can be fixed easily. test

I create a PR.

schaumb added a commit to schaumb/nameof that referenced this issue Nov 12, 2022
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