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

            Bug ID: 123752
           Summary: [reflection] data_member_spec() doesn't accept
                    default-initialized data_member_options
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: john at drouhard dot dev
  Target Milestone: ---

Given this test program:

#include <meta>

class Test {
  struct Storage;
  consteval {
    define_aggregate(^^Storage, {data_member_spec(^^int, {})});
  }
  Storage storage_;
};


results in the following (gcc compiled from git hash 81950116744 from
2026/01/21)

# g++ -std=c++26 -freflection -o test test.cpp
test.cpp:7:3: error: uncaught exception of type 'std::meta::exception';
'what()': 'neither name nor bit_width specified'
    7 |   }
      |   ^
test.cpp:8:11: error: field 'storage_' has incomplete type 'Test::Storage'
    8 |   Storage storage_;
      |           ^~~~~~~~
test.cpp:4:10: note: forward declaration of 'struct Test::Storage'
    4 |   struct Storage;
      |          ^~~~~~~

Reply via email to