-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
add default ctor for node types #2782
Conversation
…cted and this fixing clang-cl debugger visualizer
@frederick-vs-ja, could you give an example when default ctors didn't work for you? |
I find that this is still insufficient for non-default-constructible element types... For example, it seems that this example is not yet covered even after adding a (deleted) default ctor: #include <list>
class NDCType {
private:
int value_;
public:
explicit constexpr NDCType(int x) noexcept : value_{x} {}
};
int main()
{
std::list<NDCType> lsndc{NDCType{1}, NDCType{2}, NDCType{3}};
return lsndc.size();
} |
It seems that this workaround is possible
Then the default constructor is always eligible (although calling it is ill-formed), and clang will not elide the debug info. |
Co-authored-by: A. Jiang <[email protected]>
Thank you @frederick-vs-ja ! test code: #include <list>
#include <forward_list>
#include <set>
class NDCType {
private:
int value_;
public:
explicit constexpr NDCType(int x) noexcept : value_{ x } {}
bool operator <(NDCType other) const {
return value_ < other.value_;
}
};
int main()
{
std::list<NDCType> lsndc{ NDCType{1}, NDCType{2}, NDCType{3} };
std::forward_list<NDCType> flsndc{ NDCType{1}, NDCType{2}, NDCType{3} };
std::set<NDCType> sndc{ NDCType{1}, NDCType{2}, NDCType{3} };
return 0;
} |
Co-authored-by: Casey Carter <[email protected]>
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for investigating and fixing this surprising Clang/debugger interaction! 🔍 🛠️ 🎉 |
Co-authored-by: A. Jiang <[email protected]> Co-authored-by: Casey Carter <[email protected]> Co-authored-by: Stephan T. Lavavej <[email protected]>
Fixes #2749
I used the test (clang-cl + C++20):
Natvis log:
I will create an issue about visualizer
hash_set
andhash_map
, it doesn't work with Visual C++ either.