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

            Bug ID: 124202
           Summary: [reflection] Injected declarations are not detected in
                    template arguments
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: serebrennikov.vladislav at gmail dot com
  Target Milestone: ---

Consider the following example (https://godbolt.org/z/d8GfrzTj8):
```
struct S1 {};
struct S2;

template <typename T>
constexpr
std::enable_if_t<size_of(
  define_aggregate(^^S2, {
    data_member_spec(^^int, {.bit_width=sizeof(T)})
})), int*>
begin(T&);

int* end(S1& s);

void f1() {
  consteval {
    template for (auto i : S1{});
  }
}
```
At the moment of writing, this is accepted by GCC trunk on Compiler Explorer,
several days after somewhat similar
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124070 was fixed. This example
should be rejected for the same reasons outlined there.

Reply via email to