www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9538] New: 2.062: Can't use typeid on .ptr of static array

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538

           Summary: 2.062: Can't use typeid on .ptr of static array
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-19
14:03:27 PST ---
import std.stdio;

void main()
{
    void*[1] x;
    writeln(typeid(x.ptr));
}

2.061:
$ dmd test.d
 void**

2.062: $ dmd test.d
 Error: void*[1u][0u] is not an lvalue

-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538


Felix Hufnagel <puremagic zoadian.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |puremagic zoadian.de


--- Comment #1 from Felix Hufnagel <puremagic zoadian.de> 2013-02-19 14:33:13
PST ---
probably related:

immutable(char)*[1] szSource = [source.toStringz()]; 
glCreateShaderProgramv(TYPE, 1, szSource.ptr);

stopped working with dmd 2.062.
it does not pass the correct string to openGL.


and i still do not have my engine up running again, so these calls are probably
not working as well:

GLenum[] drawBuffers = [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2];
check!glDrawBuffers(drawBuffers.length, drawBuffers.ptr);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-19
14:51:32 PST ---
(In reply to comment #1)
 probably related:
 
 immutable(char)*[1] szSource = [source.toStringz()]; 
 glCreateShaderProgramv(TYPE, 1, szSource.ptr);
 
 stopped working with dmd 2.062.
 it does not pass the correct string to openGL.

Might be related to http://d.puremagic.com/issues/show_bug.cgi?id=9539 However Issue 9539 is reproducible on 2.061 as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2013-02-21 02:25:07 PST ---
(In reply to comment #2)
 (In reply to comment #1)
 probably related:
 
 immutable(char)*[1] szSource = [source.toStringz()]; 
 glCreateShaderProgramv(TYPE, 1, szSource.ptr);
 
 stopped working with dmd 2.062.
 it does not pass the correct string to openGL.

Might be related to http://d.puremagic.com/issues/show_bug.cgi?id=9539 However Issue 9539 is reproducible on 2.061 as well.

This is not related to bug 9539. https://github.com/D-Programming-Language/dmd/pull/1681 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code dawg.eu
           Severity|regression                  |normal


--- Comment #4 from Martin Nowak <code dawg.eu> 2013-02-21 11:05:52 PST ---
(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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538



--- Comment #5 from github-bugzilla puremagic.com 2013-02-21 11:10:20 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7c6a268b7eb9b7901e06aabdfb6aefc8a4017e5f
fix Issue 9538 - Regression (2.062): Can't use typeid on .ptr of static array

https://github.com/D-Programming-Language/dmd/commit/ba822749d2cc15ed984215eba10bd6638eeda326
Merge pull request #1681 from 9rnsr/fix9538

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Regression (2.062): Can't   |Regression (2.061): Can't
                   |use typeid on .ptr of       |use typeid on .ptr of
                   |static array                |static array
           Severity|normal                      |regression


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-21
11:14:08 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

You must be testing it wrong, I don't get either of these errors in 2.060 and 2.061. Make sure you're calling the right DMD and if using RDMD to use --force. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9538


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

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


--- Comment #7 from Kenji Hara <k.hara.pg 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: -------
Feb 21 2013