[PATCH] D155572: [clang][Interp] Start implementing binary operators for complex types

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 07:18:28 PDT 2023


aaron.ballman added a comment.

In D155572#4541403 <https://reviews.llvm.org/D155572#4541403>, @tbaeder wrote:

> In D155572#4539457 <https://reviews.llvm.org/D155572#4539457>, @aaron.ballman wrote:
>
>> Is this intended to not handle all the binary operators in this patch?
>
> Yes, just a subset for now.
>
>> And also, is this intended to only impact initializers?
>
> Yes, due to problems with (non-)initializers. This should work after https://reviews.llvm.org/D156027 though.

Okay, thanks for confirmation! The only outstanding thing is adding coverage for typedef types:

  using Frobble = float;
  using Bobble = _Complex float;
  using Gobble = _Complex Frobble;
  
  constexpr _Complex Frobble A = { 13.0, 2.0 };
  constexpr Bobble B = { 2.0, 1.0  };
  constexpr Gobble C = { 3.0, 5.0 };
  constexpr _Complex float D = A - B;
  constexpr _Complex float E = C - B;
  static_assert(__real(D) == 11.0, "");
  static_assert(__imag(D) == 1.0, "");
  static_assert(__real(E) == 1.0, "");
  static_assert(__imag(E) == 4.0, "");


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155572/new/

https://reviews.llvm.org/D155572



More information about the cfe-commits mailing list