[Issue 7432] DMD allows variables to be declared as pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 18 09:35:10 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=7432



--- Comment #9 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-08-18 09:35:09 PDT ---
(In reply to comment #8)
> (In reply to comment #6)
> > This is a feature of D
> 
> According to which bit of the spec?
> 
> > - in general case any attribute is legal (except those for which 
> > there are arbitrary checks and rejections) and auto can be replaced 
> > by other attributes to launch type inference.  Since pure is 
> > harmless here I think this is resolved-wontfix.
> 
> Maybe, but it doesn't seem to me to make much sense.  If it's intended
> behaviour, this needs to be stated in the spec.

Decl:
    StorageClasses Decl

StorageClasses:
    StorageClass
    StorageClass StorageClasses


StorageClass:
    abstract
    auto
    TypeCtor
    deprecated
    enum
    extern
    final
    nothrow
    override
    pure
    __gshared
    Property
    scope
    static
    synchronized

from Declaration page.

Am not telling that pure variables make much sense (I tried to clarity relation
between auto and type inference), the problem is follows:
1) pure int foo; is legal by spec and grammar
2) Despite of 1) dmd arbitrary rejects some wired combinations, sometimes not. 
3) There are other issues in Bugzilla like "storage class X is accepted in
context Y" (but don't ask which numbers, I don't remember them now). So,
situation is totally sporadic right now and it needs comprehensive solution.
Adding one check to ban pure in variable declaration is not a solution to the
problem.

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


More information about the Digitalmars-d-bugs mailing list