Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 21591 - missed backrefs in mangled names wrt. unmerged func…
…tion types TypeFunctions are apparently special and not merged, so make sure to use the generic merged function type as backref cache key. Unfortunately, this requires special care to prevent an infinite recursion, as merging is based on mangling.
- Loading branch information
Showing
4 changed files
with
51 additions
and
2 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,9 @@ | ||
struct Test(T) | ||
{ | ||
T member; | ||
size_t toHash() const { return hashOf(member); } | ||
} | ||
|
||
enum duppable(T) = is(typeof(T.init.dup)); | ||
|
||
enum test = duppable!(Test!(void delegate())[]); |
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,6 @@ | ||
import test21591a; | ||
|
||
void main() | ||
{ | ||
cast(void) (void delegate()).init; | ||
} |
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "${OS}" == "windows" ]; then | ||
echo "Skipping test21591 on Windows." | ||
exit 0 | ||
fi | ||
|
||
# Compile both modules separately and verify that the mangled names of the | ||
# `core.internal.hash.hashOf!(void delegate())` instantiations are equal | ||
# (in particular, both having the 2nd occurrence of `FZv` backref'd as `Qs`). | ||
expected="_D4core8internal4hash__T6hashOfTDFZvZQnFNaNbNiNeMxDQs" | ||
for i in a b; do | ||
obj="${OUTPUT_BASE}${i}${OBJ}" | ||
$DMD -c -m${MODEL} -of${obj} -I${EXTRA_FILES} ${EXTRA_FILES}/${TEST_NAME}${i}.d | ||
nm ${obj} | grep ${expected} | ||
rm_retry ${obj} | ||
done |