You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suppressing the number of a constant-evaluation notes is an internal error: "determine_severity_code: bad severity" #405
When constant evaluation fails in C++, the error "expression must have a constant value" (#28) carries the
interpreter's diagnostics as notes, for example "shift count is too large" (#63), "shift count is negative" (#62),
"division by zero" (#39) and "integer operation result is out of range" (#61). Each note is created as an es_more_info diagnostic, and create_diagnostic_entry (error.c) applies check_for_overridden_severity to it as
to any other diagnostic. With --diag_suppress (or #pragma diag_suppress) naming a note's number, the note gets
severity es_none. Displaying the error then reaches determine_severity_code with es_none (error.c line 3023)
and stops with an internal error. It happens in the C++ constant-expression contexts that report through error #28:
a constexpr variable, an enumerator, static_assert, an array bound, a template argument, if constexpr, alignas, a bit-field width (not a case label, which reports #39 itself, and not a narrowing template argument,
#2361). Only the text output fails: the SARIF output (--output_mode=sarif) does not compute a note's severity and
lists the suppressed note as a related location. C has no such notes and is not affected.
Reproducing Source Code
constexpr int z = 1 << 32;
Command-line Options
cpfe --c++20 --diag_suppress=63 shift.cpp
Type of Issue
[Front End] This code SHOULD compile with these options.
Additional Details
Output of at current main:
"shift.cpp", line 1: internal error: assertion failed:
determine_severity_code: bad severity (error.c, line 3023 in
determine_severity_code)
constexpr int z = 1 << 32;
^
1 error and1 catastrophic error detected in the compilation of "shift.cpp".
Compilation aborted.
Reproducing (Standard) Configuration(s)
No response
Reproducing (Non-standard) Configuration
No response
I acknowledge that:
I have checked open issues and existing discussions before filing this report.
The reproducing source code that I have provided does not depend on headers that I have not included with my submission.
I have reduced the reproducing source code to the best of my ability.
I have selected at least one standard configuration or uploaded a non-standard configuration dump.
I understand code shared via this form is NOT confidential.
I have permission to share the reproducing source code and grant permission for the project to use the source code (or derivatives of the source code) to create tests.
I agree that any tests created using the reproducing source code (or deriatives of it) will be licensed under project license unless I included a LICENSE.txt file in my .zip or .tar.gz upload. If I included a LICENSE.txt file, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.
Activity
Leave a suppressed note out of its error [GH edgcpp#405]