Fix Issue 15459 - [REG2.065.0] stdin.byLine.each!(map!somefunc) compiles, fails to link with ld#13359
Fix Issue 15459 - [REG2.065.0] stdin.byLine.each!(map!somefunc) compiles, fails to link with ld#13359RazvanN7 wants to merge 1 commit intodlang:masterfrom
Conversation
|
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 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
|
| } | ||
| NoPointersBitmapPayload!1$?:32=u|64=LU$ | ||
| { | ||
| enum $?:32=uint|64=ulong$[1] NoPointersBitmapPayload = 0$?:32=u|64=LU$; |
There was a problem hiding this comment.
Since semantic3 is made eagerly on template instances coming from typeof expressions, this is now known earlier, however, I don't really get the changes.
|
Note: I don't remember from what issue I ended up trying to solve the same bug but the solution that I came up with (*) has the same failure as yours (in checkedint.d), a speculative instantiation is not marked as such. (*) reduced fix: diff --git a/src/dmd/dscope.d b/src/dmd/dscope.d
index 42c0d18b2..064acd7f5 100644
--- a/src/dmd/dscope.d
+++ b/src/dmd/dscope.d
@@ -75,7 +75,7 @@ enum SCOPE
private enum PersistentFlags =
SCOPE.contract | SCOPE.debug_ | SCOPE.ctfe | SCOPE.compile | SCOPE.constraint |
SCOPE.noaccesscheck | SCOPE.onlysafeaccess | SCOPE.ignoresymbolvisibility |
- SCOPE.printf | SCOPE.scanf | SCOPE.Cfile;
+ SCOPE.printf | SCOPE.scanf | SCOPE.fullinst | SCOPE.Cfile;
struct Scope
{ |
|
I think there are a few duplicates of the bug being fixed here. If I can find them I will see if they really are dupes. The thing I observed debugging a similar issue with a gagged Short of actually making dmd handle this stuff properly, is there/can we come up with a way of elegantly forcing (i.e. it runs all the analysis or it's an error) semantic analysis? Some kind of fence-like abstraction if you will. Hopefully patches like this can get most of the pain, but the fact that this can actually happen is not encouraging. |
|
Maybe the recent template emission fixes will make this work. |
…piles, fails to link with ld
When the
is(typeof(map())expression is compiled,mapinstantiated, however semantic3 is not done on theMapResulttemplate instance. This leadstypeof(map())to returnvoidandis(void)evaluates totrue. Later on, whenmapis used inmain, the template instance is not re-analyzed because we already have a "valid" instantiation. When semantic3 is performed this, this time it is also gagged for some reason.My patch builds on the fact that full semantic needs to be performed in the situations where the root instantiating expression is inside a typeof context. To do that, I am adding a field to the
TemplateInstanceAST node that keeps track whether the instantiation subtree's root inside atypeofcontext.Targeting master as this is a very old regression and the fix might be controversial.