<locale>: std::ctype<char>::blank return true for all space-characters
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
Describe the bug
blank returns true for '\r', '\n' ... it just works as an alias for std::ctype::space
From https://en.cppreference.com/w/cpp/string/byte/isblank
In the default C locale, only space (0x20) and horizontal tab (0x09) are classified as blank characters.
Command-line test case
C:\Temp>type main.cpp
#include <iostream>
#include <locale>
#include <cctype>
using namespace std;
int main()
{
cout << isblank('\n') << '\n';
cout << use_facet<ctype<char>>(locale("C")).is(ctype<char>::blank,
static_cast<unsigned char>('\n')) << '\n';
cout << use_facet<ctype<char>>(locale::classic()).is(ctype<char>::blank,
static_cast<unsigned char>('\n')) << '\n';
}
C:\Temp>cl /EHsc /W4 /WX main.cpp
cl /EHsc /W4 /WX main.cpp
Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.27.29109 для x64
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
main.cpp
Microsoft (R) Incremental Linker Version 14.27.29109.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
C:\Temp>main.exe
0
1
1
Expected behavior
Should return 0 0 0
STL version
Microsoft Visual Studio Community 2019 Preview
Version 16.7.0 Preview 6.0
Additional context
VSO-429255 / AB#429255 | DevCom-215436 DevCom-246252 DevCom-51443
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the command-line test case and compare std::isblank with use_facet<ctype> for locale("C") and locale::classic(). Trace the ctype::blank classification entry point. Done means the facet calls classify '\n' consistently with std::isblank and the regression is covered by the project’s tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100