www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11614] New: Error: this for _expand_field_0 needs to be type Tuple not type Foo

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11614

           Summary: Error: this for _expand_field_0 needs to be type Tuple
                    not type Foo
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: doob me.com



The following code used to compile with DMD 2.063.2:

import std.typecons;

struct Foo
{
    alias Tuple!(int) NEW_ARGS;

    NEW_ARGS args;

    void foo ()
    {
        static if (NEW_ARGS.length == 1) {}
    }
}

But compiling the above code with DMD 2.064.2 results in this error:

typecons.d(389): Error: this for _expand_field_0 needs to be type Tuple not
type Foo

Am I doing something wrong or is this a regression? If I do any of the
following the code will compile:

* Move the static-if outside of "foo"
* Replace "NEW_ARGS.length" with "args.length" in the static-if

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11614


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
          Component|Phobos                      |DMD



https://github.com/D-Programming-Language/dmd/pull/2897

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11614




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c2ba89dc203c34740fbc21d8a116994046a7bbf4
fix Issue 11614 - Error: this for _expand_field_0 needs to be type Tuple not
type Foo

Even if a variable has no valid context, it would be either:

1. a part of compile time evaluated expression, which is used as unreal
context.
    enum x = Type.fieldvar.sizeof;
    // It's legitimate expression so fieldvar is not evaluated
    // in runtime.

2. or an invalid field access without valid 'this', in runtime evaluated
expression.
    int y = Type.fieldvar;
    // It's invalid expression so fieldvar access has no valid 'this'.


`getRightThis` should not make it an error.

https://github.com/D-Programming-Language/dmd/commit/4d994d640f32a50e3bfb84c5e99118c7a057cce4


[REG2.064] Issue 11614 - Error: this for _expand_field_0 needs to be type Tuple
not type Foo

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 30 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11614


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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