[Issue 9124] New: Object variable of variadic template struct needs explicit "this" in certain situations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 11 16:22:38 PST 2012


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

           Summary: Object variable of variadic template struct needs
                    explicit "this" in certain situations
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: puneet at coverify.org


--- Comment #0 from Puneet Goel <puneet at coverify.org> 2012-12-07 19:36:22 PST ---
Kindly look at the code pasted below. with the current github dmd snapshot, it
gives me an error:
Error: this for _val needs to be type Foo not type Foo!(28)

It is a corner case. I could not reduce the code further than give below. For
example if I replace SIZE with N[0] directly in the declarative for result, the
issue disappears.

struct Foo (N...)
{
  enum SIZE = N[0];
  private int _val;

  public void opAssign (T) (T other)
    if (is(T unused == Foo!(_N), _N...))
      {
    _val = other._val;       // compile error
    // this._val = other._val; // explicit this make it work
      }

  public auto opUnary (string op) () if (op == "~") {
    Foo!(SIZE) result = this;
    return result;
  }
}

void main()
{
  Foo!(28) a;
  Foo!(28) b = ~a;
}

--- Comment #1 from github-bugzilla at puremagic.com 2012-12-11 16:22:31 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f6b421121ff945c08bca5bafd8df07913d64a727
fix Issue 9124 - Object variable of variadic template struct needs explicit
"this" in certain situations

https://github.com/D-Programming-Language/dmd/commit/8e22c48774d4200c80e5808f5c0658d28a0625fc
Merge pull request #1366 from 9rnsr/fix9124

Issue 9124 - Object variable of variadic template struct needs explicit "this"
in certain situations

-- 
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