Bug ID: 41153
           Summary: warning: format string is not a string literal  with
                    default parameter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++

The following code produces a warning, which IMHO is wrong:

mkl@C707 ~ $ cat clang-bug.cpp

void Log(const char* str = " ", ...) __attribute__ ((format (printf, 1, 2)));

void Bug()

mkl@C707 ~ $ /usr/lib/llvm/9/bin/clang++ -c clang-bug.cpp
warning: format string is not a string literal (potentially insecure)
note: treat the string as an argument to avoid this
1 warning generated.
mkl@C707 ~ $ /usr/lib/llvm/9/bin/clang++ --version
clang version 9.0.0 (/var/tmp/portage/sys-devel/clang-9999/work/x/y/clang-9999
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/9/bin
mkl@C707 ~ $

The warning doesn’t include a line number and disappears when I add the default
argument to Log().

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to