https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125286

            Bug ID: 125286
           Summary: Print values in static_assert() diagnostics
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: diagnostics
          Assignee: dmalcolm at redhat dot com
          Reporter: [email protected]
  Target Milestone: ---

alx@devuan:~/tmp$ cat sa.c 
static_assert(sizeof(int) == 1);
alx@devuan:~/tmp$ gcc sa.c 
sa.c:1:1: error: static assertion failed
    1 | static_assert(sizeof(int) == 1);
      | ^~~~~~~~~~~~~
alx@devuan:~/tmp$ g++ sa.c 
sa.c:1:27: error: static assertion failed
    1 | static_assert(sizeof(int) == 1);
      |               ~~~~~~~~~~~~^~~~
sa.c:1:27: note: the comparison reduces to ‘(4 == 1)’


In C++ mode, we get a note which tells the value of sizeof(int).  It would be
interesting to get the same reduction in C mode.

Reported-by: Jonathan Grant <[email protected]>

Reply via email to