mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 22:50:38 +03:00
Fix Issue 21725 - Specifying null as bitfields variable name now fails
This commit is contained in:
parent
a23fa4ed06
commit
e16e0b7b97
1 changed files with 13 additions and 1 deletions
|
@ -297,7 +297,7 @@ string bitfields(T...)()
|
|||
|
||||
// would be nice to check for valid variable names too
|
||||
static if (i % 3 == 1)
|
||||
static assert(is (typeof(ARG) == string),
|
||||
static assert(is (typeof(ARG) : string),
|
||||
"Variable name expected, found " ~ ARG.stringof);
|
||||
|
||||
static if (i % 3 == 2)
|
||||
|
@ -637,6 +637,18 @@ unittest
|
|||
}
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=21725
|
||||
@safe unittest
|
||||
{
|
||||
struct S
|
||||
{
|
||||
mixin(bitfields!(
|
||||
uint, q{foo}, 4,
|
||||
uint, null, 4,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This string mixin generator allows one to create tagged pointers inside $(D_PARAM struct)s and $(D_PARAM class)es.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue