[Issue 9538] Regression (2.062): Can't use typeid on .ptr of static array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 21 16:30:43 PST 2013


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


Kenji Hara <k.hara.pg at gmail.com> changed:

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


--- Comment #7 from Kenji Hara <k.hara.pg at gmail.com> 2013-02-21 16:30:39 PST ---
(In reply to comment #4)
> (In reply to comment #0)
> > 2.061:
> > $ dmd test.d
> > > void**
> 
> I still get an error for 2.061 and 2.060.
> Error: type void*[1LU] is not an expression
> 
> The error message has changed with
> https://github.com/D-Programming-Language/dmd/pull/1382 to
> Error: void*[1u][0u] is not an lvalue.
> 
> I've reduced the importance to normal.

This is actually regression. It was introduced by fixing bug 8913.

Before fixing 8913, following wrong expression had allowed.

    alias X = int[1];
    pragma(msg, typeof(X.ptr)); // printed int*
    auto p = X.ptr;     // compiled with -o- switch

After that, it correctly be rejected in compilation phase (currently it shows
some poor error message, and I think we should improve it), but it had take out
another hidden problem in TypeQualified::resolveHelper.

The typeid operand "x.ptr" is *parsed* as a type, then resolved in
TypeIdn\entifier::resolve to the actual expression. But, the process in
resolveHelper had a bug that rewrites x.ptr to typeof(x).ptr. The 'ptr'
property for array type should be treated as like as built-in stringof and
mangleof property, but wasn't.

Finally I chose refactoring resolveHelper to fix this regression. During it, I
found another bug 9554, and they are fixed together in the pull #1681.

-- 
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