llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Clang][Windows] `-Wctad-maybe-unsupported` triggered for `std::equal_to`

Open MagentaTreehouse opened this issue 2 years ago • 1 comments

The following code, when using MSVC STL, triggers the clang warning enabled by -Wctad-maybe-unsupported.

#include <functional>
int main() { return std::equal_to{}(-1, 1); }
.\test.cpp:12:9: warning: 'equal_to' may not intend to support class template argument deduction      [-Wctad-maybe-unsupported]
   12 |         return std::equal_to{}(-1, 1);
      |                ^
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include\xutility:510:8: note:
      add a deduction guide to suppress this warning
  510 | struct equal_to {
      |        ^
1 warning generated.

This use of CTAD doesn't look harmful. The warning seems not triggered when using libc++.

MagentaTreehouse avatar Jun 24 '24 03:06 MagentaTreehouse

CC @hokein

shafik avatar Jul 04 '24 01:07 shafik