Thread overview
[Issue 17309] [REG 2.073.2] constructor template doesn't infer `pure`
Apr 08, 2017
Jack Stouffer
Apr 09, 2017
Russel Winder
Apr 11, 2017
Walter Bright
Apr 18, 2017
Walter Bright
Apr 18, 2017
Walter Bright
Apr 18, 2017
Walter Bright
Apr 18, 2017
ag0aep6g@gmail.com
April 08, 2017
https://issues.dlang.org/show_bug.cgi?id=17309

Jack Stouffer <jack@jackstouffer.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jack@jackstouffer.com
           Hardware|x86_64                      |All
            Summary|constructor template        |[REG 2.073.2] constructor
                   |doesn't infer `pure`        |template doesn't infer
                   |                            |`pure`
                 OS|Linux                       |All
           Severity|normal                      |regression

--
April 09, 2017
https://issues.dlang.org/show_bug.cgi?id=17309

Russel Winder <russel@winder.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |russel@winder.org.uk

--
April 11, 2017
https://issues.dlang.org/show_bug.cgi?id=17309

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
If the constructor is marked as 'immutable', it compiles.

It also compiles with dmd 2.070, didn't check other versions.

--
April 18, 2017
https://issues.dlang.org/show_bug.cgi?id=17309

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Walter Bright from comment #1)
> It also compiles with dmd 2.070, didn't check other versions.

I don't know what I did there. I can't get it to compile with any dmd versions I tried, so I don't think this is a regression.

--
April 18, 2017
https://issues.dlang.org/show_bug.cgi?id=17309

Walter Bright <bugzilla@digitalmars.com> changed:

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

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
I think that trouble here is that attribute inference is not done until the template is instantiated. But the compiler does not instantiate a template until it matches a template, and

    this(Range)(Range s)

does not match for constructing an immutable. I don't see a way out of this chicken-and-egg problem.

I'm going to mark this as invalid.

--
April 18, 2017
https://issues.dlang.org/show_bug.cgi?id=17309

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WONTFIX

--
April 18, 2017
https://issues.dlang.org/show_bug.cgi?id=17309

--- Comment #4 from ag0aep6g@gmail.com ---
(In reply to Walter Bright from comment #3)
> I think that trouble here is that attribute inference is not done until the template is instantiated. But the compiler does not instantiate a template until it matches a template, and
> 
>     this(Range)(Range s)
> 
> does not match for constructing an immutable. I don't see a way out of this chicken-and-egg problem.
> 
> I'm going to mark this as invalid.

1) That's a major bummer.

2) It means that Russel's issue is a phobos regression. I've filed it separately as issue 17330.

--