[Issue 10413] .init incorrectly accepts any expression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 8 08:10:59 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=10413


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #2 from monarchdodra at gmail.com 2014-04-08 08:10:53 PDT ---
(In reply to comment #1)
> With constructions like:
> template Foo(T...)
>
>      T[0].init
> is OK if T[0] is a type, but if it is a value, it won't compile.

If the template code doesn't make sense, then it doesn't compile. Seems fine to
me.

> It is in fact pretty bizarre that 2.init == 0, so this should probably be
> changed.

".init" is a static property, and as such, can be called on either type or
instance, just the same way you can write "assert(1.max == 0x7FFFFFF)". As a
matter of fact, I'm pretty sure I've seen this used before, instance of having
to pulling out the "typeof".

I'm not sure changing this would be correct.

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


More information about the Digitalmars-d-bugs mailing list