"error: call makes alias" with a scalar value

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

"error: call makes alias" with a scalar value

Post by skoe »

Can somebody explain the effect seen on IRC?

Code: Select all

< user> wtf is "error: call makes alias"?
< user> but say i have a struct bla { int x; }
< user> if i have a function f(struct bla &bla, int x)
< user> i cannot do  f(bla, bla.x)
< user> although bla.x is not a reference at all
< skoe> If you do y = bla.x; f(bla, y)?
< skoe> What happens?
< user> that just works, of course
Thomas


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

That behaviour does sound wrong but I can't recreate it. The following code compiles for me with no warnings or errors using the 10.4.2 tools.

Code: Select all

struct bla { int x; };

void f(struct bla &bla, int x) {}

int main()
{
  struct bla bla;
  f(bla, bla.x);
  return 0;
}