From 28f4ab0737937858730f29f5c4e601e109cf9d5f Mon Sep 17 00:00:00 2001 From: Jeffro <0xjeffro@gmail.com> Date: Sat, 6 Sep 2025 06:11:33 +0000 Subject: [PATCH] Add -Wno-ctad-maybe-unsupported compiler flag (#162223) When running bazel build, we (Google) run into the following error. The `-Wctad-maybe-unsupported` warning would be raised to an error and break the build in certain cases. So, we propose to suppress the warning to make the build with bazel more smooth. This is the error message we got: ``` c10/util/IntrusiveList.h:166:12: error: 'std::reverse_iterator' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported] 166 | return std::reverse_iterator{end()}; | ^ c10/test/util/IntrusiveList_test.cpp:24:18: note: in instantiation of member function 'c10::IntrusiveList<(anonymous namespace)::ListItem>::rbegin' requested here 24 | auto it = c1.rbegin(); | ^ c10/test/util/IntrusiveList_test.cpp:43:5: note: in instantiation of function template specialization '(anonymous namespace)::check_containers_equal<(anonymous namespace)::ListItem>' requested here 43 | check_containers_equal(l, v); | ^ libcxx/include/__iterator/reverse_iterator.h:51:7: note: add a deduction guide to suppress this warning 51 | class reverse_iterator | ^ 1 error generated. ``` @haifeng-jin Pull Request resolved: https://github.com/pytorch/pytorch/pull/162223 Approved by: https://github.com/ezyang --- c10/test/build.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c10/test/build.bzl b/c10/test/build.bzl index 2f54c8a2faa5..deb917dd8fcf 100644 --- a/c10/test/build.bzl +++ b/c10/test/build.bzl @@ -46,7 +46,7 @@ def define_targets(rules): "util/typeid_test.cpp", ], ), - copts = ["-Wno-deprecated-declarations"], + copts = ["-Wno-deprecated-declarations", "-Wno-ctad-maybe-unsupported"], deps = [ ":Macros", ":complex_math_test_common",