Issue Details (XML | Word | Printable)

Key: PCC-135
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

typeof can only handle simple terms

Created: 02/May/10 11:48 AM   Updated: 02/May/10 06:58 PM
Component/s: pcc backend
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File typeof.diff (0.5 kB)

Environment: NetBSD/i386


 Description  « Hide
The typeof() operative can only handle basic types, consider the following code

struct a {
        int a;
} a;

void
foo(long v)
{
        a.a = (typeof(a.a)) v;
}

which causes "compiler error: usednodes == 2, inlnodecnt 0"

similar for array elements (b[]), pointed to items (*p) and other complex terms. The attached "typeof.diff" patch to cgram.y
does not fix it but at least provides a clearer error

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 02/May/10 06:58 PM
Fixed by allowing any expressions inside typeof. Actually much simpler these days than before :-)