[Bug c++/126628] New: dllimport-ed PMF has invalid address in initializer_list
tim at klingt dot org via Gcc-bugs <[email protected]> Tue, 04 Aug 2026 04:28:06 +0000
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126628
Bug ID: 126628
Summary: dllimport-ed PMF has invalid address in
initializer_list
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tim at klingt dot org
Target Milestone: ---
Created attachment 65229
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D65229&action=3Dedit
test case
gcc-15 seems to have a regression in the way how PMF are populated inside an
initializer_list when the PMF function is dllimport: afaict the
initializer_list will populate the pointers before the dll resolution occurs
```
// wrong addresses:
const std::vector<PMF> viaInitList =3D { &Foo::methodA, &Foo::methodB,
&Foo::methodC };
// correct addresses:
std::vector<PMF> viaPushBack;
viaPushBack.push_back(&Foo::methodA);
viaPushBack.push_back(&Foo::methodB);
viaPushBack.push_back(&Foo::methodC);
```
it seems to be unrelated to the optimization level.=