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

            Bug ID: 126922
           Summary: internal compiler error when initializing a struct of
                    std::meta::info
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stephane.chea at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/71bq7cMzW

When using designated initializers with a struct with 2 or more
std::meta::info, if you initialize a member that appear after an omitted
member, this result in a internal compiler error.

This only happens when both members are std::meta::info.

```
#include <meta>

struct TestStruct {
    std::meta::info first;
    std::meta::info second;
};

template <TestStruct>
consteval void test() {}

int main() {
    test<TestStruct{.second = {}}>(); // fails, works if we swap first and
second in the struct
    // test<TestStruct{.first = {}}>(); // works
    // test<TestStruct{}>(); // works
    // test<TestStruct{.first = {}, .second = {}}>(); // works
}

```

Reply via email to