arduino / arduino/ArduinoCore-avr

internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:2697

Open
#507 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Minimal repro demo:
```C++
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 for instructions.

exit status 1

Compilation error: exit status 1
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by compiling the minimal C++17 reproduction on the reported AVR environment and compare the parenthesized and braced constructor forms. Investigate the internal compiler error at cp/constexpr.c:2697; done means the reproduction no longer triggers verify_ctor_sanity and the affected constexpr declarations compile successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.