View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0031940 | Community | OCCT:Foundation Classes | public | 2020-11-16 12:56 | 2022-04-07 14:33 |
| Reporter | xuzhongxing | Assigned To | bugmaster | ||
| Priority | normal | Severity | minor | ||
| Status | closed | Resolution | fixed | ||
| Platform | x86-64 | OS | Ubuntu Linux | ||
| Product Version | 7.1.0 | ||||
| Target Version | 7.6.0 | Fixed in Version | 7.6.0 | ||
| Summary | 0031940: Foundation Classes - TCollection_ExtendedString::Print() corrupts UNICODE strings and does not compile with C++20 | ||||
| Description | C++20 has removed operator<<(std::basic_ostream) overloads accepting char16_t (implicitly converted to integer), leading to TCollection_ExtendedString::Print() compilation error:
Standard_ExtCharacter c = mystring[i];
astream << "&#" << c << ";";
This code is obsolete anyway, as OCCT is now expected to print UTF-8 strings to stream. When compiled with gcc 10.2 -std=gnu++2a
/usr/bin/c++ -I/data1/work/studio/src/ext/opencascade-7.5.0/inc -I/data1/work/studio/src/ext/opencascade-7.5.0/src/inc -I/usr/include/freetype2 -g -march=native -fPIC -std=gnu++2a -MD -MT src/ext/opencascade-7.5.0/src/CMakeFiles/occt-objs.dir/TCollection/TCollection_ExtendedString.cxx.o -MF src/ext/opencascade-7.5.0/src/CMakeFiles/occt-objs.dir/TCollection/TCollection_ExtendedString.cxx.o.d -o src/ext/opencascade-7.5.0/src/CMakeFiles/occt-objs.dir/TCollection/TCollection_ExtendedString.cxx.o -c /data1/work/studio/src/ext/opencascade-7.5.0/src/TCollection/TCollection_ExtendedString.cxx
/data1/work/studio/src/ext/opencascade-7.5.0/src/TCollection/TCollection_ExtendedString.cxx: In member function ‘void TCollection_ExtendedString::Print(Standard_OStream&) const’:
/data1/work/studio/src/ext/opencascade-7.5.0/src/TCollection/TCollection_ExtendedString.cxx:623:26: error: use of deleted function ‘std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char16_t) [with _Traits = std::char_traits<char>]’
623 | astream << "&#" << c << ";";
| ^
In file included from /usr/include/c++/10/iostream:39,
from /data1/work/studio/src/ext/opencascade-7.5.0/inc/Standard_Stream.hxx:20,
from /data1/work/studio/src/ext/opencascade-7.5.0/inc/Standard_OStream.hxx:19,
from /data1/work/studio/src/ext/opencascade-7.5.0/inc/Standard_ExtCharacter.hxx:28,
from /data1/work/studio/src/ext/opencascade-7.5.0/inc/Standard_PrimitiveTypes.hxx:27,
from /data1/work/studio/src/ext/opencascade-7.5.0/inc/Standard_Transient.hxx:20,
from /data1/work/studio/src/ext/opencascade-7.5.0/inc/Standard.hxx:91,
from /data1/work/studio/src/ext/opencascade-7.5.0/inc/TCollection_ExtendedString.hxx:20,
from /data1/work/studio/src/ext/opencascade-7.5.0/src/TCollection/TCollection_ExtendedString.cxx:15:
/usr/include/c++/10/ostream:549:5: note: declared here
549 | operator<<(basic_ostream<char, _Traits>&, char16_t) = delete;
| ^~~~~~~~
[2743/3480] Building CXX object src/ext/opencascade-...src/CMakeFiles/occt-objs.dir/TopTools/TopTools.cxx.o
ninja: build stopped: subcommand failed.
| ||||
| Steps To Reproduce | The following test command:
static Standard_Integer TestExtString (Draw_Interpretor& theDI,
Standard_Integer ,
const char** theArgVec)
{
TCollection_AsciiString aStrUtf8 (theArgVec[1]);
TCollection_ExtendedString aStrUtf16 (aStrUtf8);
theDI << "[DI] TCollection_AsciiString: '" << aStrUtf8 << "'\n";
theDI << "[DI] TCollection_ExtendedString: '" << aStrUtf16 << "'\n";
std::cout << "[cout] TCollection_AsciiString: '" << aStrUtf8 << "'\n";
std::cout << "[cout] TCollection_ExtendedString: '" << aStrUtf16 << "'\n";
return 0;
}
produces the following output: Draw[2]> TestExtString "What чёрта с два unmöglich français! 你好" [cout] TCollection_AsciiString: 'What чёрта с два unmöglich français! 你好' [cout] TCollection_ExtendedString: 'What чёрта с два unmglich franais! 你好' [DI] TCollection_AsciiString: 'What чёрта с два unmöglich français! 你好' [DI] TCollection_ExtendedString: 'What чёрта с два unmöglich français! 你好' Note that on printing to cout, the symbols in Latin-1 range are lost ("unmöglich français" -> "unmglich franais"), and symbols in other code ranges are converted to hex values. It is expected that printing TCollection_ExtendedString should produce the same output as TCollection_AsciiString. | ||||
| Tags | No tags attached. | ||||
| Test case number | Not required | ||||
| related to | 0031881 | closed | bugmaster | Community | Coding Rules - OpenGl_HaltonSampler::initRandom() uses deprecated in C++14 function std::random_shuffle |
| child of | 0022484 | closed | bugmaster | Open CASCADE | UNICODE characters support. |
| child of | 0027676 | closed | bugmaster | Open CASCADE | Foundation Classes - define Standard_ExtCharacter, Standard_Utf16Char using C++11 types char16_t |
|
|
Branch CR31940 has been created by kgv. SHA-1: 91326f8403952d5fa774a8e9c205dfdfc55915e7 Detailed log of new commits: Author: kgv Date: Wed Nov 18 14:56:59 2020 +0300 0031940: Foundation Classes - TCollection_ExtendedString::Print() corrupts UNICODE strings and does not compile with C++20 TCollection_ExtendedString::Print() now converts string into UTF-8 instead of printing character indexes. |
|
|
Patch is ready for review - OCCT branch: CR31940. http://jenkins-test-12.nnov.opencascade.com:8080/view/CR31940-master-KGV/ |
|
|
Branch CR31940 has been updated by abv. SHA-1: d8b9418957333eec73e12ea51e76c6cecd9eb555 Detailed log of new commits: Author: abv Date: Sun Nov 22 21:46:52 2020 +0300 # added description of the change in upgrade.md |
|
|
Reviewed with minor amendment, please integrate |
|
|
Branch CR31940 has been updated forcibly by kgv. SHA-1: 32a5a77d57cb90920185eecf7ab84e886faa1247 |
|
|
Branch CR31940_1 has been created by kgv. SHA-1: 5e76ae673405ca1bf5c68d864b830e3c904875a4 Detailed log of new commits: Author: kgv Date: Wed Nov 18 14:56:59 2020 +0300 0031940: Foundation Classes - TCollection_ExtendedString::Print() corrupts UNICODE strings and does not compile with C++20 TCollection_ExtendedString::Print() now converts string into UTF-8 instead of printing character indexes. |
|
|
Combination - OCCT branch : IR-2020-11-27 master SHA - 765e5bc192b506e546ba77d881d4929dc0f69b1a a206de37fbfa0bf71bd534ae47192bbec23b8522 Products branch : IR-2020-11-27 SHA - 17b49a570b557fbeb7326a4adb10fa231b058aed was compiled on Linux, MacOS and Windows platforms and tested in optimize mode. Number of compiler warnings: No new/fixed warnings Regressions/Differences/Improvements: No regressions/differences CPU differences: Debian80-64: OCCT Total CPU difference: 18049.94000000008 / 18024.44000000013 [+0.14%] Products Total CPU difference: 12325.960000000132 / 12167.95000000011 [+1.30%] Windows-64-VC14: OCCT Total CPU difference: 19703.46875 / 19697.21875 [+0.03%] Products Total CPU difference: 13792.6875 / 13647.203125 [+1.07%] Image differences : No differences that require special attention Memory differences : No differences that require special attention |
|
|
Branch CR31940_1 has been deleted by inv. SHA-1: 5e76ae673405ca1bf5c68d864b830e3c904875a4 |
|
|
Branch CR31940 has been deleted by inv. SHA-1: 32a5a77d57cb90920185eecf7ab84e886faa1247 |
|
occt: master 90e0d12d 2020-11-18 11:56:59 Committer: bugmaster Details Diff |
0031940: Foundation Classes - TCollection_ExtendedString::Print() corrupts UNICODE strings and does not compile with C++20 TCollection_ExtendedString::Print() now converts string into UTF-8 instead of printing character indexes. |
Affected Issues 0031940 |
|
| mod - dox/upgrade/upgrade.md | Diff File | ||
| mod - src/TCollection/TCollection_ExtendedString.cxx | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2020-11-16 12:56 | xuzhongxing | New Issue | |
| 2020-11-16 12:56 | xuzhongxing | Assigned To | => abv |
| 2020-11-18 11:46 | kgv | Relationship added | related to 0031881 |
| 2020-11-18 14:55 | kgv | Target Version | => 7.6.0 |
| 2020-11-18 14:55 | kgv | Summary | Compiling failure with c++20 => Foundation Classes - TCollection_ExtendedString::Print() corrupts UNICODE strings and does not compile with C++20 |
| 2020-11-18 14:55 | kgv | Steps to Reproduce Updated | |
| 2020-11-18 14:56 | git | Note Added: 0096883 | |
| 2020-11-18 14:58 | kgv | Relationship added | child of 0022484 |
| 2020-11-18 14:59 | kgv | Relationship added | child of 0027676 |
| 2020-11-18 14:59 | kgv | Product Version | 7.5.0 => 7.1.0 |
| 2020-11-18 14:59 | kgv | Steps to Reproduce Updated | |
| 2020-11-18 15:03 | kgv | Description Updated | |
| 2020-11-18 16:36 | kgv | Note Added: 0096885 | |
| 2020-11-18 16:36 | kgv | Status | new => resolved |
| 2020-11-18 16:37 | kgv | Steps to Reproduce Updated | |
| 2020-11-22 10:59 |
|
Steps to Reproduce Updated | |
| 2020-11-22 11:01 |
|
Steps to Reproduce Updated | |
| 2020-11-22 11:02 |
|
Steps to Reproduce Updated | |
| 2020-11-22 11:07 |
|
Steps to Reproduce Updated | |
| 2020-11-22 21:46 | git | Note Added: 0096993 | |
| 2020-11-22 21:47 |
|
Note Added: 0096994 | |
| 2020-11-22 21:47 |
|
Assigned To | abv => bugmaster |
| 2020-11-22 21:47 |
|
Status | resolved => reviewed |
| 2020-11-23 08:18 | git | Note Added: 0096999 | |
| 2020-11-23 08:18 | git | Note Added: 0097000 | |
| 2020-11-28 12:45 | bugmaster | Note Added: 0097115 | |
| 2020-11-28 12:45 | bugmaster | Status | reviewed => tested |
| 2020-11-28 12:48 | bugmaster | Test case number | => Not required |
| 2020-11-28 12:48 | bugmaster | Steps to Reproduce Updated | |
| 2020-11-28 12:59 | bugmaster | Changeset attached | => occt master 90e0d12d |
| 2020-11-28 12:59 | bugmaster | Status | tested => verified |
| 2020-11-28 12:59 | bugmaster | Resolution | open => fixed |
| 2020-11-28 13:05 | git | Note Added: 0097133 | |
| 2020-11-28 13:05 | git | Note Added: 0097134 | |
| 2022-03-24 09:57 | kgv | Relationship added | related to 0032887 |
| 2022-04-07 14:33 |
|
Relationship deleted | related to 0032887 |