-
Notifications
You must be signed in to change notification settings - Fork 15k
Open
Labels
clangClang issues not falling into any other categoryClang issues not falling into any other categorymiscompilationregression:20Regression in 20 releaseRegression in 20 release
Description
This is a regression from Clang 19 to Clang 20 and is specific to 32-bit x86 Windows.
MSVC 19.50 Preview 1 (in VS 2026 Insiders) accepts the following code, while Clang 20.1.8 generates code that AVs.
C:\Temp>type meow.cpp
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <cassert>
#include <cstdio>
#include <cstring>
#include <exception>
#include <stdexcept>
using namespace std;
struct A {
~A() noexcept {
assert(uncaught_exceptions() == 2);
try {
assert(uncaught_exceptions() == 2);
throw runtime_error("say what?");
} catch (const exception&) {
assert(uncaught_exceptions() == 2);
auto c = current_exception();
try {
assert(uncaught_exceptions() == 2);
rethrow_exception(c);
} catch (const runtime_error& e) {
assert(uncaught_exceptions() == 2);
assert(strcmp("say what?", e.what()) == 0);
}
assert(uncaught_exceptions() == 2);
try {
assert(uncaught_exceptions() == 2);
throw;
} catch (const runtime_error& e) {
assert(uncaught_exceptions() == 2);
assert(strcmp("say what?", e.what()) == 0);
}
}
}
};
struct B {
~B() noexcept {
assert(uncaught_exceptions() == 1);
try {
assert(uncaught_exceptions() == 1);
A aa;
throw runtime_error("oh no!");
} catch (const exception&) {
assert(uncaught_exceptions() == 1);
auto c = current_exception();
try {
assert(uncaught_exceptions() == 1);
rethrow_exception(c);
} catch (const runtime_error& e) {
assert(uncaught_exceptions() == 1);
assert(strcmp("oh no!", e.what()) == 0);
}
assert(uncaught_exceptions() == 1);
try {
assert(uncaught_exceptions() == 1);
throw;
} catch (const runtime_error& e) {
assert(uncaught_exceptions() == 1);
assert(strcmp("oh no!", e.what()) == 0);
}
}
}
};
void meow() {
B bb;
throw runtime_error("oh no");
}
int main() {
try {
meow();
} catch (...) {
assert(uncaught_exceptions() == 0);
assert(current_exception());
}
puts("Done.");
}
C:\Temp>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od meow.cpp
meow.cpp
C:\Temp>meow
Done.
C:\Temp>echo %ERRORLEVEL%
0
C:\Temp>clang-cl /EHsc /nologo /W4 /std:c++latest /MTd /Od meow.cpp
C:\Temp>meow
C:\Temp>echo %ERRORLEVEL%
-1073741819
Metadata
Metadata
Assignees
Labels
clangClang issues not falling into any other categoryClang issues not falling into any other categorymiscompilationregression:20Regression in 20 releaseRegression in 20 release