[cfe-dev] g++ 4.2.8 vs libc++ - bug?
Marco Wisse via cfe-dev
cfe-dev at lists.llvm.org
Thu May 26 12:08:57 PDT 2016
Hi,
I hope I found the right place for this question. I was trying something
very basic, i.e. to read a double followed by a character, from cin, and
noticed that there is a difference between the way this works using g++
4.2.8 on linux and the way it does (not work) using libc++ on a mac with
the latest version of xcode.
The entire code has only a few lines:
------------------------------------------------
#include<iostream>
using namespace std;
int main() {
char c;
float d;
while(cin >> d >> c) cout << d << c << endl;
}
------------------------------------------------
When I compile this on linux using g++ 4.2.8, typing "2a", for example,
produces "2a", and so on, as required.
However, compiling this on the mac with Apple LLVM version 7.0.0
(clang-700.0.72), using
"clang++ -stdlib=libc++ --std=c++11 test.cpp", "2a", "2b", and quite a few
more, fail.
It seems strange to me that such a basic operation can produce different
results. Do you have any thoughts?
Kind regards,
Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160526/da17810f/attachment.html>
More information about the cfe-dev
mailing list