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

            Bug ID: 123974
           Summary: C++26: Reflection Expansion Statements - P1306R5:
                    Can't expand case label in switch.
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: c++26
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bakiev at elemer dot ru
  Target Milestone: ---

This sample code is not build in the current implementation.

```cpp
#include <cassert>

constexpr int test_clang(int arg) {
    switch (arg) {
        template for (constexpr auto i : { 1, 2, 3, 4, 5 })
        case i: return i * 10; // GCC error
        default: break;
    }
    return arg;
}

constexpr int test_gcc(int arg) {
    template for (constexpr auto i : { 1, 2, 3, 4, 5 })
        if (i == arg) return i * 10;
    return arg;
}

int main()
{
    //static_assert(test_clang(3) == 30); 
    static_assert(test_gcc(3) == 30);

    assert(test_clang(3) == 30);
    assert(test_gcc(3) == 30);
    return 0;
}
```

Dan Katz's Bloomberg/Clang_P2996 build all submitted code.
https://godbolt.org/z/v338jcbfP

Maybe these fixes will help you understand how to implement "Code Injection
with Token Sequences P3294R1" or similar proposals in the future.

Reply via email to