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
This commit is contained in:
Jeffro
2025-09-06 06:11:33 +00:00
committed by PyTorch MergeBot
parent c98ddaca6d
commit 28f4ab0737

View File

@ -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",