www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10488] New: Reg (2.063): Template this paramter doesn't work properly

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

           Summary: Reg (2.063): Template this paramter doesn't work
                    properly
           Product: D
           Version: future
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: doob me.com


--- Comment #0 from Jacob Carlborg <doob me.com> 2013-06-27 08:54:06 PDT ---
This code compiled with 2.062:

class Foo
{
    static void instance (this T) ()
    {
    }
}

void main ()
{
    Foo.instance();
}

With 2.063 I get this error:

main.d(10): Error: template main.Foo.instance does not match any function
template declaration. Candidates are:
main.d(3):        main.Foo.instance(this T)()
main.d(10): Error: template main.Foo.instance(this T)() cannot deduce template
function from argument types !()()

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 27 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10488


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

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


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-06-27 20:50:38 PDT ---
That was "accepts-invalid" bug.
Even with 2.062, it didn't work properly.

class Foo
{
    static void instance (this T) () {}
}
void main ()
{
    import std.typetuple;
    foreach (T; TypeTuple!(Foo, const Foo, immutable Foo))
    {
        pragma(msg, T);
        T.instance();  // fail to compile with const and immutable
    }
}

static member function does not have valid 'this' expression, so compiler
cannot deduce TemplateThisParameter with IFTI.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 27 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10488



--- Comment #2 from Jacob Carlborg <doob me.com> 2013-06-28 01:29:36 PDT ---
I thought that the whole point was to use it when "this" wasn't normally
allowed. Just like typeof(this) can be used outside instance methods.

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