Skip to content

An other preprocessing bug (probably). #1822

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

Closed
3 tasks done
jfjlaros opened this issue Aug 3, 2022 · 1 comment
Closed
3 tasks done

An other preprocessing bug (probably). #1822

jfjlaros opened this issue Aug 3, 2022 · 1 comment
Assignees
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@jfjlaros
Copy link

jfjlaros commented Aug 3, 2022

Describe the problem

A sketch containing a function that makes use of a type created with typedef does not compile under certain circumstances. This issue may be related to bug #1785.

To reproduce

When the following sketch is compiled,

void somefunction() {}
typedef int myInt;
void myTest(myInt) {}

void setup() {}
void loop() {}

this error is raised:

.../x.ino:3:18: error: variable or field 'myTest' declared void
 void myTest(myInt) {}
                  ^
.../x.ino:3:13: error: 'myInt' was not declared in this scope
 void myTest(myInt) {}
             ^~~~~

When the first two lines are swapped, the sketch compiles fine.

typedef int myInt;
void somefunction() {}
// ...

Expected behavior

Both sketches are expected to compile. For reference, the following code compiles without any errors or warnings

void somefunction() {}
typedef int myInt;
void myTest(myInt) {}

int main() {
  return 0;
}

with the following command:

g++ -std=c++11 -Wall -Wextra -pedantic x.cc

Arduino CLI version

nightly-20220803 Commit: 2dd8976 Date: 2022-08-03T01:36:48Z

Operating system

Linux

Operating system version

Debian bookworm/sid

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@jfjlaros jfjlaros added the type: imperfection Perceived defect in any part of project label Aug 3, 2022
@per1234
Copy link
Contributor

per1234 commented Aug 5, 2022

Hi @jfjlaros. Thanks for taking the time to submit an issue.

I see we have another report about this at #1269.

It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the other.

If you end up with additional information to share, feel free to comment in the other thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants