New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang++ --std=gnu++11 fails to compile <iostream> #13902
Comments
Sorry, I forgot to mention the version im running : clang --versionclang version 3.2 (trunk 161295) |
Looks like GCC 4.7 introduced more builtins that Clang will need to implement. |
Clang doesn't support the __float128 type. Here are some workarounds:
Experimentation with the LLVM fp128 and ppc_fp128 types a few months ago indicated that we have essentially no backends which support __float128 yet, so if we want to work around this directly in Clang, I think option (4) is probably the best way (add a __float128 type which is always incomplete). |
I could live with (4), although I'd prefer that we be lazy about it rather than injecting it into every translation unit. |
Doesnt that imply that this 'bug' should be turned into an 'enahancement request' for those backends ? |
One more possible workaround (and IMO the simplest for users of Clang) is to add -D__float128=void to CXXFLAGS. It doesn't require libstdc++ modifications, it doesn't require ansi mode, it's enough to make the listdc++ header pass and (hopefully) it'll still fail with any other accidental use of __float128 elsewhere. |
Patch attempt for the approach in comments #3 and #4: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130617/082233.html comment #6: Since libstdc++ marks __float128 as a floating point type, you might end up with libstdc++ thinking that void is a floating type with that define (?). |
Fixed in r184476. |
It's a workaround, and I think you can't do better without modifying libstdc++ (or clang). In practice it seems to work, the whole of LibreOffice works fine that way. |
Extended Description
clang fails compiling a hello world program when using the --std=gnu+11 option:
cat test.cpp
#include
int main() {
std::cout << "Hello, world!" << std::endl;
}
clang++ test.cpp -o test -std=gnu++11
In file included from test.cpp:1:
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/iostream:39:
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/ostream:39:
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/ios:40:
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/char_traits.h:40:
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:65:
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:61:
In file included from /usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/move.h:57:
/usr/lib/gcc/i686-redhat-linux/4.7.0/../../../../include/c++/4.7.0/type_traits:256:39: error: use of undeclared identifier '__float128'
struct __is_floating_point_helper<__float128>
^
1 error generated.
The text was updated successfully, but these errors were encountered: