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 8388 - std.traits.MemberFunctionsTuple doesn't work with constructors or destructors #5710

Closed
wants to merge 1 commit into from

Conversation

RazvanN7
Copy link
Collaborator

The template MemberFunctionsTuple calls getVirtualFunctions in order to avoid static functions, but it seems that the constructor and destructor are not grabbed (probably because those are not virtual?). In order to fix the issue I added a static if which tests if the name of the function called for is __ctor or __dtor; if that is the case, then the getOverloads function is called which correctly grabs all the ctor and dtor overloads.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
8388 std.traits.MemberFunctionsTuple doesn't work with constructors or destructors

@ghost
Copy link

ghost commented Aug 30, 2017

Should __postblit be included too ?

@jmdavis
Copy link
Member

jmdavis commented Aug 30, 2017

Should __postblit be included too ?

It looks like MemberFunctionsTuple only works on classes, so __postblit would never be there. It's been a while since I've done anything with MemberFunctionsTuple, but it looks like its purpose is to do __traits(getOverloads, ...) but take into account all base classes, which __traits(getOverloads, ...) does not.

@ghost
Copy link

ghost commented Aug 30, 2017

It looks like MemberFunctionsTuple only works on classes

Yeah, sorry.

@jmdavis
Copy link
Member

jmdavis commented Aug 30, 2017

It's okay. After seeing your comment, I was about to say something about __xpostblit. But upon seeing that MemberFunctionsTuple, I realized that neither was applicable - which is just as well, since keeping them straight is a bit annoying.

@jmdavis
Copy link
Member

jmdavis commented Aug 30, 2017

"But upon seeing that MemberFunctionsTuple was specifically for classes" of course. I guess that my brain is moving faster than my fingers right now...

@RazvanN7
Copy link
Collaborator Author

Does anyone have any ideas why I'm getting the cycle dependencies error in the autotester? I didn't add any other imports to the module and I'm afraid I don't understand what's happening.

@ghost
Copy link

ghost commented Jan 29, 2018

It was probably the static this in C. You can still try without.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants