https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108205
Bug ID: 108205 Summary: ICE following "unused parameter" in precondition Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: webrown.cpp at gmail dot com Target Milestone: --- Using (Homebrew GCC HEAD-37c2d99) 13.0.0 20221213 (experimental) and compiling via: g++-HEAD -std=c++23 -fmodules-ts -fcontracts -pedantic-errors \ -O0 -Wall -Wextra -Werror -Wpedantic \ -fno-builtin -fconcepts-diagnostics-depth=2 on an x86 MacBook Pro. This code compiles: [[nodiscard]] constexpr int quotient( double x, double y ) noexcept { [[assume (y != 0.0)]]; return int(x / y); } The same code also compiles as a module: export module test; export [[nodiscard]] constexpr int quotient( double x, double y ) noexcept { [[assume (y != 0.0)]]; return int(x / y); } But reformulating the assumption as a precondition causes issues. First, this code is diagnosed with "unused parameter 'x'", which seems misleading: [[nodiscard]] constexpr int quotient( double x, double y ) noexcept [[ pre: y != 0.0 ]] { return int(x / y); } Second, when the above is compiled as a module, the compiler additionally segfaults: export module test; export [[nodiscard]] constexpr int quotient( double x, double y ) noexcept [[ pre: y != 0.0 ]] { return int(x / y); }