[Issue 12734] Template cannot deduce E[] from typeof(null)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 17 16:28:21 UTC 2018


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

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ag0aep6g at gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to Andrej Mitrovic from comment #0)
> -----
> void take1(int[] buffer) { }
> void take2(E)(E[] buffer) { }
> 
> void main()
> {
>     take1(null);  // ok
>     take2(null);  // fail
> }
> -----
> 
> I'm not sure what 'E' would be deduced to with a typeof(null) though. Maybe
> just a 'void'? Or a 'void*'? It's hard to tell, but the above forces us to
> create overloads for the sake of supporting null.

Works since 2.067.1, with E = void. Closing as worksforme.
https://run.dlang.io/is/QhvCjh

--


More information about the Digitalmars-d-bugs mailing list