1 | #include <gtest/gtest.h> |
2 | |
3 | #include <torch/torch.h> |
4 | |
5 | struct Node {}; |
6 | |
7 | // If `torch::autograd::Note` is leaked into the root namespace, the following |
8 | // compile error would throw: |
9 | // ``` |
10 | // void NotLeakingSymbolsFromTorchAutogradNamespace_test_func(Node *node) {} |
11 | // ^ |
12 | // error: reference to `Node` is ambiguous |
13 | // ``` |
14 | void NotLeakingSymbolsFromTorchAutogradNamespace_test_func(Node* node) {} |
15 | |
16 | TEST(NamespaceTests, NotLeakingSymbolsFromTorchAutogradNamespace) { |
17 | // Checks that we are not leaking symbols from the |
18 | // `torch::autograd` namespace to the root namespace |
19 | NotLeakingSymbolsFromTorchAutogradNamespace_test_func(nullptr); |
20 | } |
21 | |