Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue 17968 - When generating xtoHash function for a struct, use
typeid(const(Object)) for class members instead of the derived type to avoid pulling in ungenerated symbols
- Loading branch information
Showing
4 changed files
with
41 additions
and
1 deletion.
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,12 @@ | ||
import test17968a; | ||
|
||
void main() | ||
{ | ||
auto r = fun2.fun1; | ||
// just check that getHash works (doesn't throw). | ||
typeid(r).getHash(&r); | ||
|
||
// try gethash when member is null. | ||
r.t = null; | ||
typeid(r).getHash(&r); | ||
} |
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,16 @@ | ||
struct S(T) | ||
{ | ||
T t; | ||
} | ||
|
||
class C(T) { } | ||
|
||
auto fun1(T)(T t) | ||
{ | ||
return S!T(t); | ||
} | ||
|
||
auto fun2() | ||
{ | ||
return new C!int; | ||
} |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}a${OBJ} -c ${EXTRA_FILES}${SEP}test17968a.d | ||
$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}${EXE} ${EXTRA_FILES}${SEP}test17968.d ${OUTPUT_BASE}a${OBJ} | ||
|
||
${OUTPUT_BASE}${EXE} | ||
|
||
rm ${OUTPUT_BASE}{a${OBJ},${EXE}} |