mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00

* Document template instance duplication status as part of its field documentation. (#16643) * Fix Bugzilla 24599 - Wrongly elided TypeInfo emission (#15868) Reverting #14844, which caused such missing TypeInfos, *and* making sure the special TypeInfo members are fully analyzed and ready for codegen (otherwise hitting an assertion for the real-world project). * Reorganize backend build files to match target and make more similar per line (#16672) * Remove redundant suggestions on linker errors (#16711) * Fix bugzilla 24337 - Segfault when printing an int[] cast from a string (#16729) * Add BitFieldStyle.Gcc_Clang_ARM Required for 32-bit ARM, and non-Apple 64-bit ARM targets. The only difference to `Gcc_Clang` is that anonymous and 0-length bit-fields do contribute to the aggregate alignment. Caught by existing proper C interop tests in runnable_cxx/testbitfields.d on such targets. The hardcoded bad tests in runnable/{bitfieldsposix64.c,dbitfieldsposix64.d} however now fail after the fix, on such targets again. * [refactor to `TargetC.contributesToAggregateAlignment(BitFieldDeclaration)` hook] * Fix Bugzilla Issue 24687 - [REG2.110] Cannot cast string-imports to select overload anymore * Also make deprecationSupplemental adhere to error limit (#16779) Co-authored-by: Dennis Korpel <dennis@sarc.nl> * Fix bugzilla 24699 - [REG2.108] No short-circuit evaluation of mixing template bool argument * Fix bugzilla 24731 - IFTI cannot handle integer expressions (#16822) * Fix Bugzilla Issue 24760 - ICE on variadic after default argument * Fix bugzilla 24790 - -vcg-ast ICE on lowered assign exp (#16914) Co-authored-by: Dennis Korpel <dennis@sarc.nl> * Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant (#16917) Co-authored-by: Dennis Korpel <dennis@sarc.nl> * Fix bugzilla 24431 - dmd -vcg-ast crashes printing failed template in… (#16916) --------- Co-authored-by: Richard (Rikki) Andrew Cattermole <richard@cattermole.co.nz> Co-authored-by: Martin Kinkelin <kinke@users.noreply.github.com> Co-authored-by: Dennis <dkorpel@users.noreply.github.com> Co-authored-by: Martin Kinkelin <mkinkelin@symmetryinvestments.com> Co-authored-by: Martin Kinkelin <noone@nowhere.com> Co-authored-by: RazvanN7 <razvan.nitu1305@gmail.com> Co-authored-by: Dennis Korpel <dennis@sarc.nl> Co-authored-by: Dennis Korpel <dkorpel@gmail.com>
74 lines
1.3 KiB
D
74 lines
1.3 KiB
D
// PERMUTE_ARGS:
|
|
|
|
// MT!"y" is analyzed from the pragma inside MT!"x"
|
|
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
CT y.offsetof = <
|
|
0 > y
|
|
CT x.offsetof = <
|
|
0 > x
|
|
---
|
|
*/
|
|
|
|
mixin template MT(string id)
|
|
{
|
|
union
|
|
{
|
|
mixin("void* " ~ id ~ ";");
|
|
}
|
|
|
|
// Evaluating `typeof(this).init` completes data layout.
|
|
pragma(msg,
|
|
"CT " ~ id ~ ".offsetof = <\n",
|
|
cast(int)typeof(this).init.i.offsetof, " > " ~ id);
|
|
}
|
|
|
|
struct S1
|
|
{
|
|
int i;
|
|
mixin MT!"x";
|
|
mixin MT!"y";
|
|
}
|
|
struct S2
|
|
{
|
|
int i;
|
|
union { void* x; }
|
|
union { void* y; }
|
|
}
|
|
struct S3
|
|
{
|
|
int i;
|
|
void* x;
|
|
void* y;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
// S1, S2, and S3 should have exactly same data layout.
|
|
static assert(S1.i.offsetof == S3.i.offsetof);
|
|
static assert(S1.i.offsetof == S3.i.offsetof);
|
|
static assert(S1.x.offsetof == S3.x.offsetof);
|
|
static assert(S1.y.offsetof == S3.y.offsetof);
|
|
static assert(S2.x.offsetof == S3.x.offsetof);
|
|
static assert(S2.y.offsetof == S3.y.offsetof);
|
|
static assert(S1.sizeof == S3.sizeof);
|
|
static assert(S2.sizeof == S3.sizeof);
|
|
|
|
S1 s = void;
|
|
|
|
s.i = 1;
|
|
assert(s.i == 1);
|
|
s.x = null;
|
|
assert(s.i == 1);
|
|
s.y = null;
|
|
assert(s.i == 1);
|
|
|
|
char a, b;
|
|
s.x = cast(void*)&a;
|
|
assert(s.x is &a);
|
|
assert(s.y is null);
|
|
s.y = cast(void*)&b;
|
|
assert(s.x is &a);
|
|
assert(s.y is &b);
|
|
}
|