[libcxx-commits] [libcxx] [libc++] Constrain additional overloads of `pow` for `complex` harder (PR #110235)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 25 11:16:53 PDT 2024
================
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T, class U> complex<__promote<T, U>::type> pow(const complex<T>&, const U&);
+// template<class T, class U> complex<__promote<T, U>::type> pow(const complex<T>&, const complex<U>&);
+// template<class T, class U> complex<__promote<T, U>::type> pow(const T&, const complex<U>&);
+
+// Test that these additional overloads are free from catching std::complex<non-floating-point>,
+// which is expected by several 3rd party libraries, see https://github.com/llvm/llvm-project/issues/109858.
+
----------------
ldionne wrote:
```suggestion
// Test that these additional overloads are free from catching std::complex<non-floating-point>,
// which is expected by several 3rd party libraries, see https://github.com/llvm/llvm-project/issues/109858.
//
// Note that we reserve the right to break this in the future if we have a reason to, but for the time being,
// make sure we don't break this property unintentionally.
```
This clarifies that this isn't something we're committing to. If someone wants to make a change in the future that would be incompatible with this and they arrive at this test, at least the comment will make them consider whether they should drop this guarantee and keep going with their change. Without the comment, this could create a haunted graveyard where someone sees we have a test for it and thinks we must maintain this property at all costs, which is what I want to avoid.
https://github.com/llvm/llvm-project/pull/110235
More information about the libcxx-commits
mailing list