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

Fix Issue 19658 - MSVC++ enum mangling #9605

Merged
merged 3 commits into from Apr 13, 2019
Merged

Conversation

kinke
Copy link
Contributor

@kinke kinke commented Apr 12, 2019

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @kinke! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
19658 blocker C++ enum mangling is wrong on Windows for other integer types

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

To target stable perform these two steps:

  1. Rebase your branch to upstream/stable:
git rebase --onto upstream/stable upstream/master
  1. Change the base branch of your PR to stable

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#9605"

@kinke kinke force-pushed the fix19658 branch 3 times, most recently from 1e62b79 to 6bb9f3b Compare April 12, 2019 21:01
@kinke
Copy link
Contributor Author

kinke commented Apr 12, 2019

Once again, the hardest part is to make sure the tests work on all platforms. The remaining failures show 2 other issues:

  • Magic enums are not supported as base types for other enums, e.g., on OSX64:
enum __c_longlong : long;
alias cpp_longlong = __c_longlong;
alias int64_t = cpp_longlong;
enum i64_19658 : int64_t { a }

=> Error: enum 'i64_19658' unable to resolve forward reference in definition

  • The CXXFLAGS: -std=c++11 is ignored on FreeBSD. Looking over d_do_test.d, that has got to be caused by the CC env variable NOT being c++...

Restrict the 2 occurrences transparently to POSIX targets only instead
of ignoring the flags altogether in d_do_test.d if the CC env variable
isn't `c++`.

Also prevent a parsed test parameter from featuring leading multiline
separators, e.g., in case a a first occurrence did not apply due to OS
mismatch, but a second one does (`CXXFLAGS(win32 win64): ...`).
…her enums

The magic enums (e.g., core.stdc.stdint.[u]int64_t aliasees on OSX) are
not required for the test, as the base type doesn't affect the C++ enum
mangling at all.
buf.writeByte('7');
break;
default:
visit(cast(Type)type);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case was deleted, but I don't see a test case for non-integer bases?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://en.cppreference.com/w/cpp/language/enum says the enum-base must be an integral type, so that works.

@WalterBright WalterBright merged commit 0af762d into dlang:master Apr 13, 2019
@kinke kinke deleted the fix19658 branch April 13, 2019 11:12
@kinke kinke mentioned this pull request Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants