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

            Bug ID: 89708
           Summary: printf and std::byte
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.bolvansky at gmail dot com
  Target Milestone: ---

#include <stdio.h>
#include <cstddef>

typedef unsigned char byte_t;

void test (byte_t a, std::byte b)
{
    printf("%u", a); // OK
    printf("%hhu", a); // OK
    printf("%u", b); // GCC warns, Clang warns and recommends %hhu
    printf("%hhu", b); // GCC warns
}

What is wrong with this code? I think we shouldn't see any warnings for
std::byte.. or?

Reply via email to