Skip to content

<locale>: std::ctype<char>::blank return true for all space-characters #1121

Description

@fsb4000

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvNextBreaks binary compatibility

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions