Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Can't use sizeof... to initialize struct template members

Open
#151 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
embedded-iot

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.

Description

#include<stdint.h>
template<typename... Ts>
struct InfoArray {
  uint8_t Number = sizeof...(Ts);
};

The code above does not compile.

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
Dominant language
HTML
Stars
91
Forks
112
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from arduino/ArduinoCore-sam

All issues in arduino/ArduinoCore-sam

Similar issues

More Embedded & IoT issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.