https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126628

            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=65229&action=edit
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 = { &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.

Reply via email to