quantumlib / Stim

A fast stabilizer circuit library.
Apache License 2.0
305 stars 88 forks source link

Resolved ambiguity in simd_word test by explicitly casting size_t to uint64_t for << operator usage. #751

Closed sengthai closed 2 months ago

Strilanc commented 2 months ago

What is the ambiguity that's being resolved?

sengthai commented 2 months ago

What is the ambiguity that's being resolved?

The ambiguity is when using the << operator between simd_word<W> and size_t type. The compiler may not determine which overloaded << operator to use. By casting one operand to uint64_t, we specify which operator to use, eliminating the ambiguity.

AntonMenshov commented 2 months ago

I confirm that without this fix, the compilation on AppleClang 15.0.0 is problematic (essentially, boiling down to the compiler erroring out on trying to find the right match for the << operator in the aforementioned unit test).

sengthai commented 2 months ago

@AntonMenshov Oh I see. Thank you for confirmation.

Strilanc commented 2 months ago

Sorry for the delay on merging this. I see you closed it; I moved the changes over to https://github.com/quantumlib/Stim/pull/758