Open
Description
Describe the problem
When trying to compile the following sketch,
template <size_t N>
void test(size_t arr[N / 2]) {}
void setup() {}
void loop() {}
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.
void test(size_t arr[N >> 1]) {}
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
Operating system
- Windows
Operating system version
- Windows 11
Additional context
For reference, the following program compiles without errors or warnings
#include <cstddef>
template <size_t N>
void test(size_t arr[N / 2]) {}
int main() {
return 0;
}
with the following command:
g++ -std=c++11 -Wall -Wextra -pedantic x.cc
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