https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/223120
This test case was added in https://github.com/llvm/llvm-project/pull/222212. Its purpose is to check that explicit constructor calls work at compile time. However, the test case left var.a uninitialized and the copy constructor reads an unitialized value. MSVC diagnoses this, but clang currently fails to do so. Change the test case to remove the unrelated problem of an uninitialized read. >From 5b468f25ad6fe883a4073b2c48f0257f00070678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Sat, 12 Sep 2026 06:26:17 +0200 Subject: [PATCH] [clang][test] Fix an uninitialized read in a test case This test case was added in https://github.com/llvm/llvm-project/pull/222212. Its purpose is to check that explicit constructor calls work at compile time. However, the test case left var.a uninitialized and the copy constructor reads an unitialized value. MSVC diagnoses this, but clang currently fails to do so. Change the test case to remove the unrelated problem of an uninitialized read. --- clang/test/SemaCXX/ms-ctor-closure.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/test/SemaCXX/ms-ctor-closure.cpp b/clang/test/SemaCXX/ms-ctor-closure.cpp index b508c595fe8e4..b893c9d7dde3e 100644 --- a/clang/test/SemaCXX/ms-ctor-closure.cpp +++ b/clang/test/SemaCXX/ms-ctor-closure.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -triple=i386-pc-win32 -std=c++23 -fms-extensions -verify +// RUN: %clang_cc1 %s -triple=i386-pc-win32 -std=c++23 -fms-extensions -verify -fexperimental-new-constant-interpreter consteval int bad(int x) { return 42 / x; } // expected-note{{division by zero}} @@ -16,10 +17,10 @@ class Test1 { }; consteval int f1() { - Test1 var; + Test1 var{10}; var.Test1::Test1(var); // expected-warning {{explicit constructor calls are a Microsoft extension}} - return 1; + return var.a; } -static_assert(f1()); +static_assert(f1() == 10); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
