Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4995 from 9rnsr/fix14985
[REG2.068.1-b1] Issue 14985 - Link failure for const TypeInfo of speculative instantiated struct
- Loading branch information
Showing
3 changed files
with
73 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module imports.linktypeinfo_file; | ||
|
||
auto filter(alias pred, R)(R r) | ||
{ | ||
return FilterResult!(pred, R)(r); | ||
} | ||
|
||
struct FilterResult(alias pred, R) | ||
{ | ||
R r; | ||
bool empty() { return r.empty; } | ||
auto front() { return r.front; } | ||
void popFront() | ||
{ | ||
while (!r.empty && pred(r.front)) | ||
r.popFront(); | ||
} | ||
} | ||
|
||
struct DirIterator | ||
{ | ||
int[] r; | ||
@property bool empty() { return r.length == 0; } | ||
@property auto front() { return r[0]; } | ||
void popFront() { r = r[1..$]; } | ||
|
||
} | ||
|
||
auto dirEntries(string path) | ||
{ | ||
bool f(int de) { return 1; } | ||
return filter!f(DirIterator()); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// EXTRA_SOURCES: imports/linktypeinfo_file.d | ||
// PERMUTE_ARGS: -g -inline -unittest -debug | ||
// COMPILE_SEPARATELY | ||
|
||
import imports.linktypeinfo_file; | ||
|
||
struct Only(T) | ||
{ | ||
private T _val; | ||
} | ||
|
||
auto only(V)(V v) | ||
{ | ||
return Only!V(v); | ||
} | ||
|
||
static struct Chain(R...) | ||
{ | ||
R source; | ||
} | ||
|
||
auto chain(R...)(R rs) | ||
{ | ||
return Chain!R(rs); | ||
} | ||
|
||
void main() | ||
{ | ||
string docRoot; | ||
|
||
const r = dirEntries(docRoot); | ||
typeof(r)[] a; | ||
a.length = 0; // require TypeInfo for const(FilterResult!(DirIterator)) | ||
} |