Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious type error for a configurably declared and configurably used function #122

Open
julianbraha opened this issue Oct 31, 2020 · 0 comments
Assignees

Comments

@julianbraha
Copy link
Contributor

In the example below, returnsOne() is only declared and used when CONFIG_ONE is defined, but SugarC still reports a type error when it is used.

#ifdef CONFIG_ONE 
int returnsOne() {
  return 1;
}
#endif
/*
int returnsZero(int input) {
  if (input == 1)
    return 0;

  else 
    return returnsZero(input - 1);
}
*/

int func(int input) {
  int x = 1;
/*
  if (2 < 3) {
    x++;
  }
*/
  #ifdef CONFIG_ONE
  if (!returnsOne()) {
    x = 4;
  }
  #endif
/*
  if (returnsZero(2)) {
    x--;
  }
*/

}

int main(void) {

  return func(2);

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants