Closed as not planned
Description
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