[clang] [Clang] fix test on 32 bits target after 561132e (PR #124593)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 09:26:19 PST 2025


https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/124593

None

>From 7cdc6c8f86283ac6a89fc8af3fb436e1ab6b16d4 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Mon, 27 Jan 2025 17:57:38 +0100
Subject: [PATCH] [Clang] fix test on 32 bits target after 561132e

---
 clang/test/SemaCXX/cxx2b-consteval-propagate.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp
index 222d482f40aa5d..868a52c3572414 100644
--- a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp
+++ b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp
@@ -534,15 +534,15 @@ namespace GH123405 {
 consteval void fn() {}
 
 template <typename>
-constexpr int tfn(int) {
+constexpr auto tfn(int) {
     auto p = &fn;  // expected-note {{'tfn<int>' is an immediate function because its body evaluates the address of a consteval function 'fn'}}
-    return int(p); // expected-error {{cast from pointer to smaller type 'int' loses information}}
+    return p;
 }
 
-int g() {
+void g() {
    int a; // expected-note {{declared here}}
-   return tfn<int>(a); // expected-error {{call to immediate function 'GH123405::tfn<int>' is not a constant expression}}\
-                       // expected-note {{read of non-const variable 'a' is not allowed in a constant expression}}
+   tfn<int>(a); // expected-error {{call to immediate function 'GH123405::tfn<int>' is not a constant expression}}\
+                // expected-note {{read of non-const variable 'a' is not allowed in a constant expression}}
 }
 
 }



More information about the cfe-commits mailing list