do not add "const" to virtual override functions in C++ headers#5673
Merged
WalterBright merged 1 commit intodlang:masterfrom Apr 16, 2016
Merged
do not add "const" to virtual override functions in C++ headers#5673WalterBright merged 1 commit intodlang:masterfrom
WalterBright merged 1 commit intodlang:masterfrom
Conversation
Member
|
Auto-merge toggled on |
rainers
added a commit
to rainers/ldc
that referenced
this pull request
Apr 17, 2016
manual port of dmd commit c838a96a47b783c5a7e08abbd5761f14e19b6233 see dlang/dmd#5673
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In C++, adding const to a virtual member function does not override the member function of the base class. The dmd headers do not repeat "virtual", so a new non-virtual member function is added.
Removing "const" from the declarations might cause inconsistent mangling, but calling these functions from C++ (as LDC does for a few, see ldc-developers/ldc#1421) is probably expecting the virtual call anyway (which does not need any mangled symbols).
With enough type information the optimizer might still attempt to call the virtual function directly with wrong mangling, but with this PR the failure is not silent anymore.