[Issue 24] GDC backend uses invalid type when using deferencing toPtr on a static array inside of a struct.

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Thu Nov 1 13:23:11 PDT 2012


http://gdcproject.org/bugzilla/show_bug.cgi?id=24

--- Comment #2 from Daniel Green <venix1 at gmail.com> 2012-11-01 20:23:11 UTC ---
When dealing with "if (c.b)" GDC does the correct thing and throws an error.

In this case b is of type char[1] and we're taking the pointer using .ptr . 
The type then becomes char*.  After which we dereference it into what should be
a 'char' a valid scalar.

However, GDC returns the original type char[1].  Which is what generates the
error shown.

To help contrast this, if we remove the struct and do

===

char[1] d;

void main()
{
    if (*d.ptr) return;
    return;
}

It compiles without an error even though it should be equivalent to the
previous operation.  Derefencing a pointer of static char[1].

-- 
Configure issuemail: http://gdcproject.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all issue changes.


More information about the D.gnu mailing list