-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++20][Modules] Can't import <complex> and <iostream> at the same time with libc++ #60358
Comments
@llvm/issue-subscribers-clang-modules |
May be the same as #58540 |
The diagnostic message is misleading. All member functions clang complains about are in both header units and even the AST matches. The preprocessor output also reveals no big differences. There seems to be a problem with the merging. Update: While checking the |
Here is a still big repro for this issue: headerunits_repro.zip Update: |
@Arthapz Can you check if this issue occurs with a clang build with this flag: |
Here is a big reproducer: // ostream.hpp
namespace std {
inline namespace __1 {
template <class _CharT> struct char_traits;
}
} // namespace std
namespace std {
inline namespace __1 {
class ios_base;
template <class _CharT, class _Traits = char_traits<_CharT>> class basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT>>
class basic_ostream;
typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios;
typedef basic_ostream<char> ostream;
typedef basic_ostream<wchar_t> wostream;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(ios)))
__attribute__((__preferred_name__(wios))) basic_ios;
} // namespace __1
} // namespace std
namespace std {
inline namespace __1 {
class ios_base {
public:
class failure;
virtual ~ios_base();
protected:
ios_base() {}
void init(void *__sb);
};
template <class _CharT, class _Traits> class basic_ios : public ios_base {
public:
typedef _Traits traits_type;
explicit basic_ios(void *__sb);
~basic_ios() override;
protected:
basic_ios() {}
void init(void *__sb);
};
template <class _CharT, class _Traits>
inline basic_ios<_CharT, _Traits>::basic_ios(void *__sb) {
init(__sb);
}
template <class _CharT, class _Traits>
basic_ios<_CharT, _Traits>::~basic_ios() {}
template <class _CharT, class _Traits>
inline void basic_ios<_CharT, _Traits>::init(void *__sb) {}
} // namespace __1
} // namespace std
namespace std {
inline namespace __1 {
extern template class basic_ios<char>;
}
} // namespace std
namespace std {
inline namespace __1 {
template <class _CharT, class _Traits>
class __attribute__((__type_visibility__("default"))) basic_ostream
: virtual public basic_ios<_CharT, _Traits> {
public:
inline explicit basic_ostream(void *__sb) { this->init(__sb); }
~basic_ostream() override;
protected:
inline basic_ostream(basic_ostream &&__rhs);
protected:
basic_ostream() {}
};
} // namespace __1
} // namespace std // a.hpp
#include "ostream.hpp" // b.hpp
#include "ostream.hpp" // main.cpp
import "a.hpp";
import "b.hpp";
std::basic_ostream<char> test()
{
return std::basic_ostream<char>(nullptr);
}
Output:
Note: For brevity, this reproducer highlights the issue only with the constructor and no other functions, like the streaming operators. But the root cause should be the same. |
This snippet fails to build on df34581 with https://reviews.llvm.org/D142704 applied
The text was updated successfully, but these errors were encountered: