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

            Bug ID: 122355
           Summary: internal compiler error: in validate_constant, at
                    c-family/c-format.cc:321
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tmb99 at gmx dot net
  Target Milestone: ---

The following code produces an internal compiler error for the static version
of the log function:


#include <stdio.h>

class Bug
{
public:
        void log(const int lvl, const char *file, int line, const char *format,
...);
        static void static_log(const int lvl, const char *file, int line, const
char *format, ...);
        void foo();
};

__attribute__ ((format (printf, 5, 6))) void
Bug::log(const int lvl, const char *file, int line, const char *format, ...)
{
}
__attribute__ ((format (printf, 5, 6))) void
Bug::static_log(const int lvl, const char *file, int line, const char *format,
...)
{
}

void
Bug::foo()
{
        log(0, NULL, -1, "ok");
        static_log(0, NULL, -1, "borked");
}




> g++-14 -freport-bug test.cpp

test.cpp:32:19: internal compiler error: in validate_constant, at
c-family/c-format.cc:321
0x7d912e22a1c9 __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x7d912e22a28a __libc_start_main_impl
        ../csu/libc-start.c:360




> gcc --version
g++-14 (Ubuntu 14.2.0-4ubuntu2~24.04) 14.2.0

Reply via email to