Skip to content

Commit 10913df

Browse files
committed
[libcxx] Initialize vcruntime __std_exception_data in the exception copy ctor
This fixes failures in a number of tests, in the clang-cl-no-vcruntime configuration (where libcxx provides dummy, no-op replacements of some vcruntime base exception classes), if building with optimization enabled. Previously, with optimization enabled, the compiler concluded that these fields would be uninitialized at the points of asserts in the tests. This fixes the following tests in this configuration: llvm-libc++-shared-no-vcruntime-clangcl.cfg.in :: std/language.support/support.dynamic/alloc.errors/bad.alloc/bad_alloc.pass.cpp llvm-libc++-shared-no-vcruntime-clangcl.cfg.in :: std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_new_length.pass.cpp llvm-libc++-shared-no-vcruntime-clangcl.cfg.in :: std/language.support/support.exception/bad.exception/bad_exception.pass.cpp llvm-libc++-shared-no-vcruntime-clangcl.cfg.in :: std/language.support/support.exception/exception/exception.pass.cpp llvm-libc++-shared-no-vcruntime-clangcl.cfg.in :: std/language.support/support.rtti/bad.cast/bad_cast.pass.cpp llvm-libc++-shared-no-vcruntime-clangcl.cfg.in :: std/language.support/support.rtti/bad.typeid/bad_typeid.pass.cpp
1 parent cca454b commit 10913df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/include/__exception/exception.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class exception { // base of all library exceptions
4848
__data_._DoFree = true;
4949
}
5050

51-
exception(exception const&) _NOEXCEPT {}
51+
exception(exception const&) _NOEXCEPT : __data_() {}
5252

5353
exception& operator=(exception const&) _NOEXCEPT { return *this; }
5454

0 commit comments

Comments
 (0)