https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120785
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2025-06-23
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Keywords| |diagnostic
Blocks| |87403
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
struct MyStruct {
int values[1];
} __attribute__((packed));
template <int N>
void f(const int (&a)[N]);
int main() {
MyStruct *a = new MyStruct();
f(a->values);
}
```
So span is normally not warning about temporaries but I suspect we should warn
for the above case even without not dealing with span which creates a temporary
because of the non-binding to const int for the packed fields.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning