Changes between Initial Version and Version 1 of Ticket #282


Ignore:
Timestamp:
Mar 25, 2025, 11:17:03 AM (5 months ago)
Author:
ajbeach
Comment:

I found another problem that appears to be related:

forall(T &)
struct inner {
    T * basic;
};

forall(T &)
This may just be a special case of #166.
struct outer {
    inner(T) in;
};

int main() {
    outer(int) data;
    int test = -7;
    data.in.basic = &test;
}

The error message is the generated says that the generated _dtype_static_member_ is a pointer and you need to use ->.

This problem also occurs if the in field is an inline structure, that is how the problem was discovered, but the problem goes away if:

  • The nested structure uses a concrete type (inner(int) in).
  • You access a field on the outer structure, although you have to add one first.
  • The outer structure is changed to a sized polymorphic type. Changing both has the same effect and you can't change just the inner one.

The code around the static member variable is pretty confusing, I have dug into it at least three times; when this ticket was opened, just recently and when I tried to remove the variable all together (which should be possible via C code). None of these attempts got very far. There is some weird stuff, most notably an assignment of a pointer to a reference that stops working if you "fix it", and whether the problem is actually here or in a later pass (the lvalue pass is very involved, so there could be a problem there).

Note: Removed a reference to #166 which turned out to be incorrect.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #282

    • Property Keywords member added
  • Ticket #282 – Description

    initial v1  
    3434
    3535Because the error message is triggered by convert, as translation continues and eventually the conversion may never need to happen, the initial error messages will probably change.
    36 
    37 This may just be a special case of #166.