Hi,
Looks like a bug. If I add the struct A definition above the struct B
definition, then it compiles. But, that is not in line with what I’d expect
considering c/c++ behavior(Just need the definition somewhere as long as it’s
forward declared).
The below code compiles for what it’s worth. Thanks for reporting this and can
you please create an issue on github?
----- test.ispc
// forward declaration of A
struct A;
// definition of A
struct A
{
int mX;
};
struct B
{
uniform A * uniform mA;
};
export void
run()
{
B b;
// BUG: this does not compile ???
b.mA->mX = 3;
// but this is fine
// uniform A * uniform a2 = b.mA;
// a2->mX = 3;
}
Thanks,
Deepak
From: [email protected] [mailto:[email protected]] On
Behalf Of Brian Green
Sent: Friday, June 28, 2019 4:21 PM
To: Intel SPMD Program Compiler Users <[email protected]>
Subject: Parsing Bug?
Using -> to dereference a struct is incorrectly complaining that it is being
applied to a declared but not defined struct, when the struct in question is
first forward declared:
test.ispc:21:5: Error: Member operator
"->" can't be applied to
declared but not defined struct
type "uniform struct A".
b.mA->mX = 3;
^^^^^^^^
This is using ispc-1.9.2. Is this a known issue? Am I incorrectly thinking
that this should work? The example below may look a little contrived, in
practice we are hitting this issue when the forward declaration takes place in
header files and the definition is only brought into the needed compilation
units.
Cheers,
-Brian
----- test.ispc
// forward declaration of A
struct A;
struct B
{
uniform A * uniform mA;
};
// definition of A
struct A
{
int mX;
};
export void
run()
{
B b;
// BUG: this does not compile ???
b.mA->mX = 3;
// but this is fine
// uniform A * uniform a2 = b.mA;
// a2->mX = 3;
}
--
You received this message because you are subscribed to the Google Groups
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ispc-users/6a1365c5-9aa1-4759-9364-0b7544eef5ca%40googlegroups.com<https://groups.google.com/d/msgid/ispc-users/6a1365c5-9aa1-4759-9364-0b7544eef5ca%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ispc-users/B5E5BDBDFECA1B48841B8FE58B2D87A040906637%40ORSMSX121.amr.corp.intel.com.
For more options, visit https://groups.google.com/d/optout.