Compiling in C++20 mode

Yuriy Skalko yuriy.skalko at gmail.com
Tue Dec 29 10:17:20 UTC 2020


> I'm not sure how this line compiled at all with earlier standards on Linux (where char_type is wchar_t). How wchar_t was outputted into char stream? 

It produced the integer value before C++20:
https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2

So, the patch attached here should work as in earlier standards.


Yuriy
-------------- next part --------------
diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp
index dd43dd9eac..478e906308 100644
--- a/src/mathed/MathParser.cpp
+++ b/src/mathed/MathParser.cpp
@@ -370,9 +370,9 @@ ostream & operator<<(ostream & os, Token const & t)
 		os << '\\' << to_utf8(cs);
 	}
 	else if (t.cat() == catLetter)
-		os << t.character();
+		os << static_cast<uint32_t>(t.character());
 	else
-		os << '[' << t.character() << ',' << t.cat() << ']';
+		os << '[' << static_cast<uint32_t>(t.character()) << ',' << t.cat() << ']';
 	return os;
 }
 


More information about the lyx-devel mailing list