DMD 1.033 and 2.017 releases

Bill Baxter dnewsgroup at billbaxter.com
Fri Jul 11 22:09:41 PDT 2008


Bill Baxter wrote:
> Jarrett Billingsley wrote:
>> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
>> news:g591bf$j5j$2 at digitalmars.com...
>>> For Tango.
>>>
>>> http://www.digitalmars.com/d/1.0/changelog.html
>>> http://ftp.digitalmars.com/dmd.1.033.zip
>>>
>>> http://www.digitalmars.com/d/2.0/changelog.html
>>> http://ftp.digitalmars.com/dmd.2.017.zip
>>
>> Regression fixes _for the win_.  Let's see more of this ;) 
> 
> Maybe sooner than you were thinking:
> 
> Is there any incantation I can use to make the code below work now?
> 
> I saw that typeof(Type.member) is no longer considered valid, but it 
> seems neither are any of the replacements I can think of.
> 
> 
> --------------
> struct Thing(Scalar)
> {
>     Scalar x,y,z;
> }
> 
> alias typeof(Thing!(float).x) SC; /* This version used to work */
> /+
> bug.d(30): Error: this is not in a struct or class scope
> bug.d(30): Error: 'this' is only allowed in non-static member functions, 
> not main
> bug.d(30): Error: this for x needs to be type Thing not type int
> +/
> 
> alias typeof(Thing!(float).init.x) SC2;
> /+
> bug.d(32): Error: undefined identifier struct Thing.init
> bug.d(32): Error: no property 'x' for type 'void'
> +/
> 
> alias typeof((Thing!(float).init).x) SC2;
> /+
> bug.d(37): Error: Thing!(float).init is used as a type
> bug.d(37): Error: no property 'x' for type 'void'
> +/
> 
> void main()
> {
> }
> 
> --bb


Looks like this works:
alias typeof((Thing!(float)).init.x) SC2;

But I think this is a bug.  The parentheses shouldn't be necessary there 
I don't think.

I've also run into another case here where in a template struct

   static if(typeof(*this).static_bool) { .. }

fails, but with extra parens it works:

   static if((typeof(*this)).static_bool) { .. }

Also works if you define an extra alias

   private alias typeof(*this) TypeofThis
   static if(TypeofThis.static_bool) { .. }


--bb


More information about the Digitalmars-d-announce mailing list