Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.1.2, 4.1.3
-
None
-
all
Description
According to 27.5.2.4.1 [streambuf.virt.locales], p3, the default behavior of std::streambuf::imbue() is to do nothing. The program below detects
whether the function stores the locale passed to it (it's not expected to). When compiled against the latest trunk the program abots at runtime
indicating that the function does, in fact, store the locale, contrary to the requirement.
$ cat z.cpp && make z && ./z
#include <cassert>
#include <locale>
#include <streambuf>
struct MyFacet: std::locale::facet
{ static std::locale::id id; };
std::locale::id MyFacet::id;
int main ()
{
struct MyBuf: std::streambuf {
void imbue (const std::locale &loc)
} buf;
const std::locale loc (buf.getloc (), new MyFacet);
assert (std::has_facet<MyFacet>(loc));
assert (!std::has_facet<MyFacet>(buf.getloc ()));
buf.imbue (loc);
assert (!std::has_facet<MyFacet>(buf.getloc ()));
}
gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long z.cpp
gcc z.o -o z -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s -lsupc++ -lm
Assertion failed: !std::has_facet<MyFacet>(buf.getloc ()), file z.cpp, line 23
Abort (core dumped)