[libcxx-commits] [libcxx] 853059a - [libc++] Addresses LWG3782.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 28 09:31:24 PST 2023


Author: Mark de Wever
Date: 2023-02-28T18:31:17+01:00
New Revision: 853059a15011fd8b57dd01b5189805fc8408e87f

URL: https://github.com/llvm/llvm-project/commit/853059a15011fd8b57dd01b5189805fc8408e87f
DIFF: https://github.com/llvm/llvm-project/commit/853059a15011fd8b57dd01b5189805fc8408e87f.diff

LOG: [libc++] Addresses LWG3782.

  3782. Should <math.h> declare ::lerp?

Libc++ doesn't declare ::lerp, adds tests to validate the requirement.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D142817

Added: 
    libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp

Modified: 
    libcxx/docs/Status/Cxx2bIssues.csv

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/Cxx2bIssues.csv b/libcxx/docs/Status/Cxx2bIssues.csv
index 4e9d2eda66eda..1635613be418d 100644
--- a/libcxx/docs/Status/Cxx2bIssues.csv
+++ b/libcxx/docs/Status/Cxx2bIssues.csv
@@ -227,7 +227,7 @@
 "`3775 <https://wg21.link/LWG3775>`__","Broken dependencies in the ``Cpp17Allocator`` requirements", "November 2022","","",""
 "`3778 <https://wg21.link/LWG3778>`__","``vector<bool>`` missing exception specifications", "November 2022","","",""
 "`3781 <https://wg21.link/LWG3781>`__","The exposition-only alias templates ``cont-key-type`` and ``cont-mapped-type`` should be removed", "November 2022","|Nothing to do|","",""
-"`3782 <https://wg21.link/LWG3782>`__","Should ``<math.h>`` declare ``::lerp``?", "November 2022","","",""
+"`3782 <https://wg21.link/LWG3782>`__","Should ``<math.h>`` declare ``::lerp``?", "November 2022","|Complete|","17.0",""
 "`3784 <https://wg21.link/LWG3784>`__","std.compat should not provide ``::byte`` and its friends", "November 2022","","",""
 "`3785 <https://wg21.link/LWG3785>`__","``ranges::to`` is over-constrained on the destination type being a range", "November 2022","","","|ranges|"
 "`3788 <https://wg21.link/LWG3788>`__","``jthread::operator=(jthread&&)`` postconditions are unimplementable under self-assignment", "November 2022","","",""

diff  --git a/libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp b/libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
new file mode 100644
index 0000000000000..658d60c960df2
--- /dev/null
+++ b/libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// When built with modules, this test gives diagnostics like
+//  declaration of 'lerp' must be imported from module 'std.compat.cmath'
+//  before it is required
+// therefore disable the test in this configuration.
+// UNSUPPORTED: modules-build
+
+// <math.h>
+
+// [support.c.headers.other]/1
+//   ... except for the functions described in [sf.cmath], the
+//   std::lerp function overloads ([c.math.lerp]) ...
+
+#include <math.h>
+
+void f() {
+  {
+    float f;
+    ::lerp(f, f, f);    // expected-error {{no member named 'lerp' in the global namespace}}
+    std::lerp(f, f, f); // expected-error {{no member named 'lerp' in namespace 'std'}}
+  }
+  {
+    double d;
+    ::lerp(d, d, d);    // expected-error {{no member named 'lerp' in the global namespace}}
+    std::lerp(d, d, d); // expected-error {{no member named 'lerp' in namespace 'std'}}
+  }
+  {
+    long double l;
+    ::lerp(l, l, l);    // expected-error {{no member named 'lerp' in the global namespace}}
+    std::lerp(l, l, l); // expected-error {{no member named 'lerp' in namespace 'std'}}
+  }
+}


        


More information about the libcxx-commits mailing list