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

            Bug ID: 121016
           Summary: coroutine appears to be allergic to {()}
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: beewoolie at proton dot me
  Target Milestone: ---

Greetings,

I will attach the preprocessed source to this message.  I think I see what the
compiler doesn't accept.

/** *** FIXME: code generates a compiler error when enclosed in ({}) */
#define COTHREAD_PROTOTHREAD(f) ({                                      \
      using namespace Glow::Cothreads;                                  \
      int result = Completed;                                           \
      do {                                                              \
        int v = f;                                                      \
        result = Completed;                                             \
        if (v & THREAD_READY)    result = Yielded;                      \
        if (v & THREAD_BLOCKED)  result = Blocked;                      \
        if (v & THREAD_SLEEPING) result = Sleeping;                     \
        if (result != Completed)                                        \
          co_yield cothread_result{result};                             \
      } while (result != Completed); })

When this macro body is enclosed in ({}), the compiler throws an error.

COMPILE  projects/blink/blink.cc
projects/blink/blink.cc: In function 'void
Console::cothread_main_console(cothread_main_console(Glow::Cothreads::cothread_corral&,
const
char*)::_ZN7Console21cothread_main_consoleERN4Glow9Cothreads6corralINS1_15cothread_resultEEEPKc.Frame*)':
projects/blink/blink.cc:242:3: internal compiler error: in
gimplify_var_or_parm_decl, at gimplify.cc:3308
  242 |   }
      |   ^
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://bugs.linaro.org/> for instructions.

Of course, I'd like to isolate the 'using namespace' clause, so the use of this
form is preferable.

Reply via email to