[Issue 12914] New: std.typecons.alignForSize will not accept immutable names argument

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jun 13 10:09:34 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12914

          Issue ID: 12914
           Summary: std.typecons.alignForSize will not accept immutable
                    names argument
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: atrout at chatham.edu

// The following code compiles and works as expected.

import std.typecons;
struct X {}
struct Y {}
alias FieldTypes = TypeTuple!(X,Y);

struct A
{
    mixin(alignForSize!(FieldTypes)(["x","y"]));
}

// However, the following fails to compile, giving the message:
// "Error: alignForSize (string[] names...) is not callable using argument
types (immutable(char[][]))"

immutable string[] fieldNames = ["x", "y"];
struct B
{
    mixin(alignForSize!(FieldTypes)(fieldNames));
}


// I think the problem is due to alignForSize having the incorrect signature:
// string alignForSize(E...)(string[] names...);

// If I'm not mistaken it should be something like:
// pure string alignForSize(E...)(in string[] names...); 

// This is my first posted bug and I'm no D guru, so hopefully I'm not simply
confused about something. Thanks!

--


More information about the Digitalmars-d-bugs mailing list