struct InfoEntry
{
bool Value;
constexpr InfoEntry(bool Value) : Value(Value) {}
};
struct InfoDict
{
InfoEntry Entry[1];
constexpr InfoDict(InfoEntry Entry):Entry({Entry}){}
//constexpr InfoDict(InfoEntry Entry):Entry{Entry}{} //This line is OK. Only differs in the should-be-optional parenthesis.
};
void setup()
{
constexpr InfoDict ID(InfoEntry(true));
//constexpr InfoDict ID(true); //This line is OK. It looks like the compiler can only handle POD types here.
}
void loop()
{}
Environments:
v1.8.5
-std=gnu++17
Arduino Mega or Mega 2560
Arduino IDE 2.0.0
Windows 11
Full error prompt:
C:\Users\vhtmf\Documents\Arduino\sketch_sep21a\sketch_sep21a.ino: In function 'void setup()':
C:\Users\vhtmf\Documents\Arduino\sketch_sep21a\sketch_sep21a.ino:13:40: in constexpr expansion of 'InfoDict(InfoEntry(true))'
C:\Users\vhtmf\Documents\Arduino\sketch_sep21a\sketch_sep21a.ino:13:40: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:2697
constexpr InfoDict ID(InfoEntry(true));
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
exit status 1
Compilation error: exit status 1
Minimal repro demo:
Environments:
Full error prompt: