//===----------------------------------------------------------------------===// // // Copyright 2024 Bloomberg Finance L.P. // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // RUN: %clang_cc1 %s -std=c++23 -freflection struct S { unsigned i:2, j:6; }; consteval auto member_number(int n) { if (n == 0) return ^^S::i; else if (n == 1) return ^^S::j; } int main() { S s{0, 0}; s.[:member_number(1):] = 42; // Same as: s.j = 42; }