https://bugs.llvm.org/show_bug.cgi?id=36996
Bug ID: 36996
Summary: libc++ tests compare std::fpos with int
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: billy.on...@gmail.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
Libc++ tests, such as
test\std\input.output\file.streams\fstreams\filebuf.virtuals\seekoff.pass.cpp
contain asserts like the following:
typedef std::filebuf::pos_type pos_type;
...
pos_type p = /* ... */
assert(p == 11);
The assert line fails to compile on MSVC because overloads have similar
conversions. Either a user defined conversion can be done from fpos to
streamoff, and then the streamoff compared with int, or the int can be
converted to a streamoff converted into an fpos, and the fpos instances
compared.
.\src\qa\vc\Libs\libcxx\upstream\test\std\input.output\file.streams\fstreams\filebuf.virtuals\seekoff.pass.cpp(35):
error C2666: 'std::fpos<_Mbstatet>::operator ==': 3 overloads have similar
conversions
D:\msvc\binaries\x86ret\inc\iosfwd(101): note: could be 'bool
std::fpos<_Mbstatet>::operator ==(std::streamoff) const'
D:\msvc\binaries\x86ret\inc\iosfwd(96): note: or 'bool
std::fpos<_Mbstatet>::operator ==(const std::fpos<_Mbstatet> &) const'
[ ... ]
.\src\qa\vc\Libs\libcxx\upstream\test\std\input.output\file.streams\fstreams\filebuf.virtuals\seekoff.pass.cpp(35):
note: or 'built-in C++ operator==(std::streamoff, int)'
.\src\qa\vc\Libs\libcxx\upstream\test\std\input.output\file.streams\fstreams\filebuf.virtuals\seekoff.pass.cpp(35):
note: while trying to match the argument list '(pos_type, int)'
[fpos.operations] Table 104 only allows comparison of an fpos with other fpos
instances, not with int. Either the tests should cast the integral value into
an fpos before doing the comparison, or the fpos should be cast to a streamsize
or streamoff.
(Billy is willing to submit a change to resolve this bug but isn't sure which
way you want the cast to go)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs