-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Backslash incorrectly inserted into generated prototype for multiline template function #1785
Open
3 tasks done
Labels
topic: build-process
Related to the sketch build process
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Comments
Thanks for your report @jfjlaros. You can see the problem in the program produced after Arduino sketch preprocessing:
Note the backslash that was inserted into the generated prototype: template <size_t N>void test(size_t arr[N \/ 2]); |
per1234
added
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
labels
Jun 27, 2022
Here is an other one. The following function definition template <size_t N>
void func(double const (&)[N]) {} gives rise to these errors (different than the ones in the previous example) arduino-cli compile --fqbn arduino:avr:pro --warnings all --output-dir build \
--build-property compiler.cpp.extra_flags="-pedantic"
.../x.ino:3:45: error: variable or field 'func' declared void
.../x.ino:3:30: error: expected primary-expression before 'double' while template <size_t N> void func(double const (&)[N]) {} compiles fine. |
3 tasks
3 tasks
3 tasks
per1234
changed the title
Preprocessing bug
Backslash incorrectly inserted into generated prototype for multiline template function
Sep 2, 2024
3 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
topic: build-process
Related to the sketch build process
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
When trying to compile the following sketch,
this error is raised:
arduino-cli compile --fqbn arduino:avr:pro --warnings all --output-dir build \ --build-property compiler.cpp.extra_flags="-pedantic" .../x.ino.cpp:2:7: warning: line number out of range #line 0 ".../x.ino" ^ .../x.ino:0:43: error: stray '\' in program .../x.ino:6:7: warning: line number out of range
When the function definition is changed as follows, everything works fine.
This issue seems to be independent of which core is used (tried AVR and ESP) and of which platform is used (tried Linux and Wokwi simulator).
Arduino CLI version
4a4b784
Operating system
Operating system version
Additional context
For reference, the following program compiles without errors or warnings
with the following command:
Issue checklist
The text was updated successfully, but these errors were encountered: