arduino / arduino/ArduinoCore-sam
Can't use sizeof... to initialize struct template members
- Dominant language
- HTML
- Stars
- 91
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
```C++
#include
template
struct InfoArray {
uint8_t Number = sizeof...(Ts);
};
```
The code above does not compile.
```text
C:\Users\vhtmf\Documents\Arduino\sketch_nov5a\sketch_nov5a.ino:4:20: error: expected ';' at end of member declaration
uint8_t Number = sizeof...(Ts);
^
C:\Users\vhtmf\Documents\Arduino\sketch_nov5a\sketch_nov5a.ino:4:26: error: expected unqualified-id before '...' token
uint8_t Number = sizeof...(Ts);
^
C:\Users\vhtmf\Documents\Arduino\sketch_nov5a\sketch_nov5a.ino:4:20: error: expected primary-expression at end of input
uint8_t Number = sizeof...(Ts);
^
exit status 1
Compilation error: expected ';' at end of member declaration
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the minimal InfoArray template in C:\Users\vhtmf\Documents\Arduino\sketch_nov5a\sketch_nov5a.ino and reproduce the reported compiler errors. Then inspect the Arduino SAM compilation toolchain's handling of C++ parameter packs; done means identifying the cause and documenting or resolving whether sizeof...(Ts) can initialize the member.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100