Author: Jan Schultke
Date: 2026-06-29T00:48:05+04:00
New Revision: 8cdf6346f46c505928a9fb9d3ef9e8ce125a2108

URL: 
https://github.com/llvm/llvm-project/commit/8cdf6346f46c505928a9fb9d3ef9e8ce125a2108
DIFF: 
https://github.com/llvm/llvm-project/commit/8cdf6346f46c505928a9fb9d3ef9e8ce125a2108.diff

LOG: [clang] Add test for CWG3129 (#206335)

Adds a test for [CWG3129](https://wg21.link/CWG3129) "Clarify which 
floating-point-literals are valid".

Clang has supported floating-point literals with overly tiny or huge
exponents since 3.0, with only a warning emitted.

Added: 
    

Modified: 
    clang/test/CXX/drs/cwg31xx.cpp
    clang/www/cxx_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/cwg31xx.cpp b/clang/test/CXX/drs/cwg31xx.cpp
index c5d6322009093..512f3cfa2ca92 100644
--- a/clang/test/CXX/drs/cwg31xx.cpp
+++ b/clang/test/CXX/drs/cwg31xx.cpp
@@ -14,8 +14,6 @@
 // RUN: %clang_cc1 -std=c++23 %s -fexceptions -fcxx-exceptions 
-pedantic-errors -fexperimental-new-constant-interpreter -verify-directives 
-verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20
 // RUN: %clang_cc1 -std=c++2c %s -fexceptions -fcxx-exceptions 
-pedantic-errors -fexperimental-new-constant-interpreter -verify-directives 
-verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20
 
-// cxx98-14-no-diagnostics
-
 namespace cwg3106 { // cwg3106: 2.7
 #if __cplusplus >= 201103L
 const char str[9] = R"(\u{1234})";
@@ -29,6 +27,25 @@ static_assert(noexcept(noexcept(f())), "");
 #endif
 } // namespace cwg3128
 
+namespace cwg3129 { // cwg3129: 3.0
+
+float huge_f = 1e10000000000F;
+// expected-warning-re@-1 {{magnitude of floating-point constant too large for 
type 'float'; maximum is {{.*}}}}
+float tiny_f = 1e-1000000000F;
+// expected-warning-re@-1 {{magnitude of floating-point constant too small for 
type 'float'; minimum is {{.*}}}}
+
+double huge_d = 1e10000000000;
+// expected-warning-re@-1 {{magnitude of floating-point constant too large for 
type 'double'; maximum is {{.*}}}}
+double tiny_d = 1e-1000000000;
+// expected-warning-re@-1 {{magnitude of floating-point constant too small for 
type 'double'; minimum is {{.*}}}}
+
+long double huge_ld = 1e10000000000L;
+// expected-warning-re@-1 {{magnitude of floating-point constant too large for 
type 'long double'; maximum is {{.*}}}}
+long double tiny_ld = 1e-1000000000L;
+// expected-warning-re@-1 {{magnitude of floating-point constant too small for 
type 'long double'; minimum is {{.*}}}}
+
+} // namespace cwg3129
+
 namespace cwg3135 { // cwg3135: 23
 #if __cplusplus >= 201703L
 struct Pinned {

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index ef30b5eefea13..9988fcd333e75 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -21720,7 +21720,7 @@ <h2 id="cxxdr">C++ defect report implementation 
status</h2>
     <td>[<a href="https://wg21.link/lex.fcon";>lex.fcon</a>]</td>
     <td>DR</td>
     <td>Clarify which <I>floating-point-literal</I>s are valid</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 3.0</td>
   </tr>
   <tr id="3130">
     <td><a 
href="https://cplusplus.github.io/CWG/issues/3130.html";>3130</a></td>


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to