Closed RalphSteinhagen closed 10 months ago
@llvm/issue-subscribers-clang-frontend
@shafik I tried to reduce the problem to a true MVP but those did not reproduce the crash. Maybe this is linked to the complexity, possibly unbound internal stack size, or similar that is just not reported correctly on the crash.
However, I reduced the problem to the location that needs to be commented out (last commit) that triggered this crash.
Hope this helps. A fix and/or any workaround would be highly appreciated. Thanks in advance.
@ivan-cukic found a viable workaround for the requires {...}
clause evaluation inside the constexpr-if expression. This works out fine for our purposes. Kudos to Ivan. :+1:
diff --git a/include/settings.hpp b/include/settings.hpp
index 3c1e7a6..61abbca 100644
--- a/include/settings.hpp
+++ b/include/settings.hpp
@@ -207,12 +207,14 @@ public:
fair::graph::tag::DEFAULT_TAGS);
// handle meta-information for UI and other non-processing-related purposes
- auto iterate_over_member = [&](auto member) {
- using RawType = std::remove_cvref_t<decltype(member(*_node))>;
+ auto iterate_over_member = [&]<typename Member>(Member &&member) {
+ using RawType = typename Member::value_type;// std::remove_cvref_t<decltype(member(*_node))>;
// disable clang format because v16 cannot handle in-line requires clauses with return types nicely yet
// clang-format off
- if constexpr (requires(Node t) { { unwrap_if_wrapped_t<decltype(t.meta_information)> {} } -> std::same_as<property_map>; }) {
- if constexpr (requires(Node t) { { t.description } -> std::same_as<const std::string_view &>; }) {
+ if constexpr (requires(Node t) { t.meta_information; }) {
+ static_assert(std::is_same_v<unwrap_if_wrapped_t<decltype(_node->meta_information)>, property_map>);
+ if constexpr (requires(Node t) { t.description; }) {
+ static_assert(std::is_same_v<std::remove_cvref_t<unwrap_if_wrapped_t<decltype(_node->description)>>, std::string_view>);
_node->meta_information.value["description"] = std::string(_node->description);
}
Please feel free to close this issue or keep it open if you want to investigate why clang16 and not clang15 crashes further.
It seems that this issue has also been fixed by https://github.com/llvm/llvm-project/pull/76967, I can compile this code locally using clang trunk.
I encountered an internal compiler crash in Clang 16 when compiling a C++20 project that previously compiled without issues using Clang 15, GCC 12, and GCC 13. It appears to be related to handling of template code with
constexpr if
and concepts.Environment
Stack Trace
Full code is here: clang16_regression.zip
Additional Information
The crash seems to occur in template code with
constexpr if
and concepts. Specifically, the code between lines 288919-288936 in the attached source code. Disabling this section makes the code compile with Clang 16.Here is the specific section of the code (constructor) where the crash occurs:
Any help or workaround would be highly appreciated. Thank you for your time and effort in improving Clang! :+1: