Skip to content

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

Open
@Ebola-Chan-bot

Description

@Ebola-Chan-bot
#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions