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

Ofria, Charles <ofria at msu dot edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ofria at msu dot edu

--- Comment #4 from Ofria, Charles <ofria at msu dot edu> ---
The core problem appears to be `requires` sometimes failing if using any
captured local variable.  Here is a simple example that compiles and works
correctly on MSVC and clang (outputting "PASS!"), but returns "FAIL!" or
crashes on 13.1 or newer versions of GCC:

    #include <print>

    template <typename T>
    void foo() {
      T value{};
      auto fun = [&]() requires requires { value==1; }{};

      std::println("{}", requires {fun();} ? "PASS!" : "FAIL!");
    }

    int main() {
      foo<int>();
    }

I will note that it doesn't fail 100% of the time.  In the example above, if I
simplify pretty much anything else it worked correctly (such as making `value`
type int directly, moving the `requires requires` right into the printing, etc.

Reply via email to