Skip to content

Fix Issue 19688 - [ICE] Default function argument concatenation crashes DMD - #9377

Merged
RazvanN7 merged 1 commit into
dlang:masterfrom
RazvanN7:Issue_19688
Feb 20, 2019
Merged

RazvanN7 merged 1 commit into
dlang:masterfrom
RazvanN7:Issue_19688

Conversation

@RazvanN7

@RazvanN7 RazvanN7 commented Feb 20, 2019 •

Copy link
Copy Markdown
Contributor

__FUNCTION__ and __PRETTY_FUNCTION__, unlike the other special attributes (__LINE__, __MODULE__ etc.), cannot be resolved at parse time when they are used as default function arguments because they need to be evaluated to the function in where the call takes place. The problem here is that when default arguments are evaluated in functionParameters [1], resolveLoc is called on a CatExp AST node which does not implement an override for resolveLoc, so it defaults to the one in Expression, which does .... nothing. In order to fix this, I overloaded the function and recursively called resolveLoc on the expressions of the CatExp.

[1] https://github.com/dlang/dmd/blob/master/src/dmd/expressionsem.d#L1739

@dlang-bot

Copy link
Copy Markdown

Thanks for your pull request and interest in making D better, @RazvanN7! 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
✓ 19688 normal [ICE] Default function argument concatenation crashes DMD

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#9377"

@RazvanN7
RazvanN7 merged commit d68453e into dlang:master Feb 20, 2019
@wilzbach

Copy link
Copy Markdown
Contributor

ALL BUGFIXES SHOULD TARGET STABLE!!!

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.

4 participants