mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
38 lines
679 B
C++
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
|