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

            Bug ID: 123727
           Summary: [Reflection] -freflection -fmodules produces
                    'recursive lazy load' error
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: webrown.cpp at gmail dot com
  Target Milestone: ---

Here is file reflection__bug1a (to be compiled first):

```
export module reflection__bug1a;

template< class To >
struct
  bc_cpo final
{
  template< class From >
  static constexpr To
    operator () ( From const & from )
  {
    static_assert( sizeof(From) == sizeof(To) );
    return __builtin_bit_cast(To, from);
  }
};

export
template< class To >
inline constexpr bc_cpo<To> bc{ };
```

And here is file reflection__bug1.cc (to be compiled second):
```
export module reflection__bug1;

import reflection__bug1a;

struct
  do_it final
{
  using F = double;
  using T = unsigned long;
  static_assert( sizeof(F) == sizeof(T) );
  static constexpr T
    operator () ( F f ) { return bc<T>(f); }
}
constexpr do_it{ };
```

Compiled each with 16.0.1 20260116 build, using these major flags:
        -std=c++26 -fmodules-ts -freflection -fcontracts \
        -Wall -Wextra -Werror -Wpedantic -pedantic-errors

The first file compiles cleanly, but the second produces diagnostic:
   ... error: recursive lazy load
A colleague reports the same behavior on a second architecture.

However, each compiles cleanly without the -freflection flag.

This symptom seems similar to those of bug 122785 and bug 116382.

Reply via email to