Skip to content

error compiling current master because of Debug.cpp #97

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

Closed
underdoeg opened this issue Jun 4, 2020 · 4 comments
Closed

error compiling current master because of Debug.cpp #97

underdoeg opened this issue Jun 4, 2020 · 4 comments

Comments

@underdoeg
Copy link

Error message is

use of deleted function ‘std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char32_t) [with _Traits = std::char_traits<char>]’

System is an up to date arch. g++ 10.1.0

uncommenting this line "fixes" the issue
https://github.com/mosra/corrade/blob/master/src/Corrade/Utility/Debug.cpp#L551

@mosra mosra added this to the 2020.0a milestone Jun 4, 2020
@mosra
Copy link
Owner

mosra commented Jun 4, 2020

Thanks! I'm still on GCC 9, so this is new to me. Will update my Arch and check why this happens -- honestly not sure why such function would be deleted, neither libc++ nor MSVC STL has any problem with that 🤔

@mosra
Copy link
Owner

mosra commented Jun 4, 2020

Ah, that's a new thing in C++20: https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2

I don't understand why anyone would want such behavior, but whatever (I don't get the point of 90% of the stuff added in C++17 and up, especially the insanities with std::byte or char8_t). Before I am able to upgrade -- if you do the following, does it compile?

diff --git a/src/Corrade/Utility/Debug.cpp b/src/Corrade/Utility/Debug.cpp
index fb538c67..5d1d9e99 100644
--- a/src/Corrade/Utility/Debug.cpp
+++ b/src/Corrade/Utility/Debug.cpp
@@ -561,7 +561,7 @@ Debug& Debug::operator<<(long double value) {
 
 Debug& Debug::operator<<(char32_t value) {
     std::ostringstream o;
-    o << "U+" << std::hex << std::uppercase << std::setw(4) << std::setfill('0') << value;
+    o << "U+" << std::hex << std::uppercase << std::setw(4) << std::setfill('0') << std::uint32_t(value);
     return print(o.str());
 }
 

@underdoeg
Copy link
Author

I kinda get wanting a difference between byte and char. but yeah breaking backwards compatibility like that is not great.
Your fix seems to work though. thanks

@mosra
Copy link
Owner

mosra commented Jun 5, 2020

Great, pushed as ea3fd53 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants