[Issue 4935] New: std.bitmanip: bitfields!() template with trailing unnamed field does not work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 24 09:00:58 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4935

           Summary: std.bitmanip: bitfields!() template with trailing
                    unnamed field does not work
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: ah08010-d at yahoo.com


--- Comment #0 from Austin Hastings <ah08010-d at yahoo.com> 2010-09-24 09:00:16 PDT ---
Despite the documentation in the library reference manual, a nameless field
cannot be set as the "last" entry in a list of bit fields:

This code:
==========
module scratch;
import std.bitmanip;

version(unittest) {
    void main() { }
}

struct S {
    mixin(bitfields!(
        uint, "some", 4,
    uint, "", 4                     
    ));
}
==========
Produces this error:
==========
$ dmd -unittest -run bronze/util/scratch.d
bronze\util\scratch.d(14): Error: variable scratch.S.some conflicts with
function scratch.S.some at bronze\util\scratch.d(12)
==========
Strangely, leading nameless fields are okay. This code compiles fine:
==========
struct S {
    mixin(bitfields!(
        uint, "", 1,
        uint, "", 1,
        uint, "some", 4,
        uint, "last", 2                 
    ));
}
==========

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list