[clang] [Clang] Only check for error in C++20 mode (PR #84624)

via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 9 03:39:52 PST 2024


https://github.com/Sirraide created https://github.com/llvm/llvm-project/pull/84624

Fix a test that was added in #81014 and which caused buildbots to fail. Only check for the ‘never produces a constant expression error’ in C++20 mode.

This fixes #84623.

>From c1c882866ba65626879e053682f9fdea72194ec2 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Sat, 9 Mar 2024 12:36:52 +0100
Subject: [PATCH] [Clang] Only check for error in C++20 mode

---
 clang/test/SemaCXX/cxx23-assume.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/SemaCXX/cxx23-assume.cpp b/clang/test/SemaCXX/cxx23-assume.cpp
index 2b99cbd3e788a1..2d7c9b174d9019 100644
--- a/clang/test/SemaCXX/cxx23-assume.cpp
+++ b/clang/test/SemaCXX/cxx23-assume.cpp
@@ -65,8 +65,8 @@ static_assert(h(4) == sizeof(int));
 static_assert(__has_cpp_attribute(assume) == 202207L);
 static_assert(__has_attribute(assume));
 
-constexpr bool i() { // expected-error {{never produces a constant expression}}
-  [[assume(false)]]; // expected-note {{assumption evaluated to false}} expected-note {{assumption evaluated to false}} ext-warning {{C++23 extension}}
+constexpr bool i() { // ext-error {{never produces a constant expression}}
+  [[assume(false)]]; // ext-note {{assumption evaluated to false}} expected-note {{assumption evaluated to false}} ext-warning {{C++23 extension}}
   return true;
 }
 



More information about the cfe-commits mailing list