[Issue 19703] New: Algebraic doesn't work with alias this of templated type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 26 21:55:50 UTC 2019


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

          Issue ID: 19703
           Summary: Algebraic doesn't work with alias this of templated
                    type
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: skocznymr at gmail.com

import std.variant;

struct Vector(int T)
{
  float[T] elements;
}

struct Color
{
  Vector!4 vec;
  alias vec this;
}

Algebraic!(Color,Vector!4) foo;

void main()
{
  foo = Color();
}


according to run.dlang.io:

Up to      2.068.2: Success and no output
           2.069.2: Failure with output:
-----
/path/to/dmd/dmd2/linux/bin64/../../src/phobos/std/variant.d(578): Error:
static assert  "Cannot store a Color in a VariantN!(16LU, Color, Vector!4).
Valid types are (Vector!4, Vector!4)"
onlineapp.d(18):        instantiated from here: opAssign!(Color)
-----

           2.070.2: Failure with output: (same as above)
           2.071.2: Failure with output: (same as above)
           2.072.2: Failure with output: (same as above)
           2.073.2: Failure with output: (same as above)
2.074.1 to 2.075.1: Failure with output: (same as above)
2.076.1 to 2.078.1: Failure with output: (same as above)
2.079.1 to 2.080.1: Failure with output: (same as above)
2.081.2 to 2.083.1: Failure with output: (same as above)
Since      2.084.0: Failure with output: (same as above)

--


More information about the Digitalmars-d-bugs mailing list