Files
swift-mirror/test/Interop/Cxx/namespace/Inputs/templates-with-forward-decl.h
Egor Zhdan fc2dc6aa17 C++ Interop: improve skipping already imported struct members
This fixes the issue that prevents `std::string::size_type` from being imported into Swift: `size_type` is imported before its parent struct, and  we're skipping it when importing the struct afterwards.

This is caused by an out-of-line decl for `std::string::npos`:
```cpp
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_FUNC_VIS
const typename basic_string<_CharT, _Traits, _Allocator>::size_type
               basic_string<_CharT, _Traits, _Allocator>::npos;

```
When importing `npos`, we first import `size_type`, which triggers the issue.
2021-07-17 14:45:22 +03:00

38 lines
679 B
C++

#ifndef TEST_INTEROP_CXX_NAMESPACE_INPUTS_TEMPLATES_WITH_FORWARD_DECL_H
#define TEST_INTEROP_CXX_NAMESPACE_INPUTS_TEMPLATES_WITH_FORWARD_DECL_H
namespace NS1 {
template <typename T>
struct Decl;
typedef Decl<int> di;
} // namespace NS1
namespace NS1 {
template <typename T>
struct ForwardDeclared;
template <typename T>
struct Decl {
typedef T MyInt;
ForwardDeclared<T> fwd;
const static MyInt intValue = -1;
};
template <typename T>
const typename Decl<T>::MyInt Decl<T>::intValue;
} // namespace NS1
namespace NS1 {
template <typename T>
struct ForwardDeclared {};
} // namespace NS1
#endif // TEST_INTEROP_CXX_NAMESPACE_INPUTS_TEMPLATES_WITH_FORWARD_DECL_H