<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55805>55805</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Printf format checks are skipped for constexpr format strings
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          paradust7
      </td>
    </tr>
</table>

<pre>
    demo.cpp:
```
#include <cstdio>

constexpr const char* foo() {
  return "%s %d";
}

struct Bar {
    static constexpr char value[] = {'%', 's', '%', 'd', '\0'};
};
constexpr char Bar::value[];

int main() {
   printf(foo(), "abc", "def");
   printf(Bar::value, "abc", "def");
   return 0;
}
```

Clang does not produce any warning. gcc 11.2.0 produces both warnings:
```
demo.cpp: In function ‘int main()’:
demo.cpp:13:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘const char*’ [-Wformat=]
demo.cpp:14:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘const char*’ [-Wformat=]
```

Clang version is:
```
clang version 15.0.0 (https://github.com/llvm/llvm-project.git a72cc958a386e5fc97e8c30137fb56eb77ef571c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVMlu2zAQ_RrqQligKFPLQQfHToHeeijQY0GRlMVGJgUuifP3JWk7lp0maI8FBK4z855mHqfX_LXj4qBzNs-g3AC0A2gDKnT-TltcSsUmzwUE5ZZZx6UG5eP5Mo1MK-vEcTYwrSAbqQF4AwetAW4AbiGoH06mEBrhvFEQYAwwsWEmPK7LswGod8vQ1hnPHHygZhkDQuuokwwukAMmfKaTF4A8ALILZHfJBdcBIo3bAFbb6_LmnC_OyRbFKTBZsrqs7zADtZi6crMAv_qlUSoHD1Sq98mAswmXQ7h4y9WJBKY9SylKGy6GtGnfAi9d7xj8rf-5EOgPqb9TQBq3E1V7yLWwUGkX0DX3TECqXuELNUqqfQ73jMGiyHGOLvcW9tqNFwv7kcgWIoRfFRy8Yk7qoJJHDBoE2uY2hZfj9i3eIkBRxmEdQ51h43LQ5kDdNWDS3SUMDOUUzFlIzd4fRMDSA3Svs7ghcEUNWe29u1qXcKT2zuHmKVyRgkBWP05kgkKjVt7xj9SL6v_i_4lknoWxsZbyw-qzG7uC5CgIKFR6dG5OTvhL-PbSjb7PmT6EzTQ9X6ZVkNqv8Pd5MIC0xoy1pKFlUwkysLYWDStRUdZDTyrR17UYSF2wKKKE_T0kQbiY4WNT_azWK6-elH5Rq0kqf1ztlT_bjUZQDg-aiylaz9rK4yf_nvGu5G3Z0sxJN4nuW3qtlzKyUbCnWC4B7ZOcZ8HjzaKdne1C-4vPJvNm6v4tG2ErrfUi9LsvhDSIZGOHUU95UVWEhDRRVFPUl5TzivYFH3BDson2YrJdbGIYK_ECU4jYOsguk8EfY1ShApF1WbQ56vuaNnW_rpoGM16BNRLhjU555JFrs89Mlyj1Prz8NZqkdfZ6Sa2VeyVEd-qZGfVu1KabqaHcW1dnCbxL5H8DxvDmtA">