[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-30 Thread Shafik Yaghmour via cfe-commits
@@ -67,6 +68,69 @@ void B::g() requires true; } // namespace cwg2847 +namespace cwg2851 { // cwg2851: 19 + +#if __cplusplus >= 202002L +template struct Val { static constexpr T value = v; }; + + +// Floating-point promotions + +static_assert(Val::value == 0.0L);

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-30 Thread Mital Ashok via cfe-commits
@@ -67,6 +68,69 @@ void B::g() requires true; } // namespace cwg2847 +namespace cwg2851 { // cwg2851: 19 + +#if __cplusplus >= 202002L +template struct Val { static constexpr T value = v; }; + + +// Floating-point promotions + +static_assert(Val::value == 0.0L);

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread Shafik Yaghmour via cfe-commits
@@ -67,6 +68,69 @@ void B::g() requires true; } // namespace cwg2847 +namespace cwg2851 { // cwg2851: 19 + +#if __cplusplus >= 202002L +template struct Val { static constexpr T value = v; }; + + +// Floating-point promotions + +static_assert(Val::value == 0.0L);

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread Mital Ashok via cfe-commits
https://github.com/MitalAshok updated https://github.com/llvm/llvm-project/pull/90387 >From 77cb28e6faf95f5beb3fadc225cb5f0525b3dfe6 Mon Sep 17 00:00:00 2001 From: Mital Ashok Date: Sun, 28 Apr 2024 09:48:47 +0100 Subject: [PATCH] [clang] Implement CWG2851: floating-point conversions in

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread Mital Ashok via cfe-commits
https://github.com/MitalAshok updated https://github.com/llvm/llvm-project/pull/90387 >From 0b8176cf2171da0ce780c15131e19a24473a6989 Mon Sep 17 00:00:00 2001 From: Mital Ashok Date: Sun, 28 Apr 2024 09:48:47 +0100 Subject: [PATCH] [clang] Implement CWG2851: floating-point conversions in

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: https://github.com/llvm/llvm-project/pull/90352 has been merged. https://github.com/llvm/llvm-project/pull/90387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread via cfe-commits
@@ -6229,7 +6231,37 @@ static ExprResult BuildConvertedConstantExpression(Sema , Expr *From, if (Result.isInvalid()) return Result; - // Check for a narrowing implicit conversion. + if (SCS->Second == ICK_Floating_Conversion) { Sirraide wrote:

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread Mital Ashok via cfe-commits
@@ -6229,7 +6231,37 @@ static ExprResult BuildConvertedConstantExpression(Sema , Expr *From, if (Result.isInvalid()) return Result; - // Check for a narrowing implicit conversion. + if (SCS->Second == ICK_Floating_Conversion) { MitalAshok wrote:

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread via cfe-commits
@@ -6229,7 +6231,37 @@ static ExprResult BuildConvertedConstantExpression(Sema , Expr *From, if (Result.isInvalid()) return Result; - // Check for a narrowing implicit conversion. + if (SCS->Second == ICK_Floating_Conversion) { Sirraide wrote: ‘all

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread via cfe-commits
@@ -6229,7 +6231,37 @@ static ExprResult BuildConvertedConstantExpression(Sema , Expr *From, if (Result.isInvalid()) return Result; - // Check for a narrowing implicit conversion. + if (SCS->Second == ICK_Floating_Conversion) { Sirraide wrote: Is

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread via cfe-commits
https://github.com/Sirraide commented: The approach here looks correct, but I’m not sure it’s in the right place. https://github.com/llvm/llvm-project/pull/90387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-29 Thread via cfe-commits
https://github.com/Sirraide edited https://github.com/llvm/llvm-project/pull/90387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-28 Thread Mital Ashok via cfe-commits
MitalAshok wrote: Waiting on #90352 because it's not on the cxx_dr_status page yet (`make_dr_status` doesn't do anything) https://github.com/llvm/llvm-project/pull/90387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-28 Thread Mital Ashok via cfe-commits
https://github.com/MitalAshok updated https://github.com/llvm/llvm-project/pull/90387 >From 13e2943dea677daf8976ab55a673d43982ac8a4c Mon Sep 17 00:00:00 2001 From: Mital Ashok Date: Sun, 28 Apr 2024 09:48:47 +0100 Subject: [PATCH] [clang] Implement CWG2851: floating-point conversions in

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-28 Thread Mital Ashok via cfe-commits
https://github.com/MitalAshok updated https://github.com/llvm/llvm-project/pull/90387 >From a87399f8a41bb7d9a61c2d44c75836d86c6b4c38 Mon Sep 17 00:00:00 2001 From: Mital Ashok Date: Sun, 28 Apr 2024 09:48:47 +0100 Subject: [PATCH] [clang] Implement CWG2851: floating-point conversions in

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-28 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: I'm fine with the way DR test is written, but I'm not qualified to review the contents on the test, unfortunately. I'd like to point to related Core issues [CWG2836](https://cplusplus.github.io/CWG/issues/2836.html) and

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Mital Ashok (MitalAshok) Changes https://cplusplus.github.io/CWG/issues/2851.html The only time the target type for a converted constant expression is a floating-point type is in a NTTP, so this only affects C++20+. --- Full diff:

[clang] [clang] Implement CWG2851: floating-point conversions in converted constant expressions (PR #90387)

2024-04-28 Thread Mital Ashok via cfe-commits
https://github.com/MitalAshok created https://github.com/llvm/llvm-project/pull/90387 https://cplusplus.github.io/CWG/issues/2851.html The only time the target type for a converted constant expression is a floating-point type is in a NTTP, so this only affects C++20+. >From