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

--- Comment #3 from Dimitri Gorokhovik <dimitri.gorokhovik at free dot fr> ---
(In reply to Andrew Pinski from comment #2)
> Also c++20 changes constexpr is handled which is why inline asm is accepted
> now IIRC.

This code:

constexpr auto f()
{
  asm("before:");
  constexpr auto r = 129;
  asm("after:");

  return r;
};

produces:
bug-2.cpp: In function ‘constexpr auto f()’:
bug-2.cpp:3:3: error: inline assembly is not a constant expression
    3 |   asm("before:");
      |   ^~~
bug-2.cpp:3:3: note: only unevaluated inline assembly is allowed in a
‘constexpr’ function in C++2a

Reply via email to