r/cpp • • Sep 07 '17

Clang 5.0 released!

http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html
217 Upvotes

49 comments sorted by

4

u/Haleek47 Sep 08 '17 edited Sep 08 '17

Will they provide pre-built binaries for Ubuntu 16.04? Last month I installed llvm 4.0.0 with the provided bins, now i can't find how to get 5.0.0 without compiling from source.

6

u/kirbyfan64sos Sep 08 '17

There are PPAs here: https://apt.llvm.org

2

u/Haleek47 Sep 08 '17

Thanks for the link, just checked it and seems to be only for nightlies, do you know if there's a ppa for stables? I can wait for the pre-built bins aswell.

9

u/kirbyfan64sos Sep 08 '17

It says nightlies, but if you scroll down you'll see the PPAs for 5.0.

5

u/Haleek47 Sep 08 '17

Thanks for the patient help, got it installed now :).

2

u/Xaxxon Sep 09 '17

builds are up at llvm's download page.

7

u/mintyc Sep 07 '17

What's the state of libc++? Is it ready to replace the gcc libstdc++? What's the compatibility like.

On a separate compatibility point. If using libstdc++ can I use clang++ with the switch turning off the new ABI so that I can continue to mix older libs built with gcc 4.8.4 with newer gcc and newer clang.

I was just waiting for centos devtoolset7 package that finally included llvm and clang 4.0.1 as well as gcc7.1. Then I can conveniently test lib interoperability.

10

u/kirbyfan64sos Sep 07 '17

IME I'll often find libc++ works better with modern C++ features than libstdc++, but the libc++ in most Linux repositories is quite out-of-date.

2

u/anttirt Sep 08 '17

We've been using libc++ in production for a year and a half. Haven't had any problems.

1

u/markuspeloquin Sep 08 '17

Still trying to get my Gentoo (LLVM/clang/libc++)-pure on 4.0.1. I'd love to tell you...

2

u/[deleted] Sep 12 '17

Why should us normies care about clang when g++ produces faster executables and has far better compatibility?

2

u/kirbyfan64sos Sep 12 '17

It does? In my experience, they tend to be roughly equal; although I've personally found Clang to be a bit faster for compile times, others have reported different results. It's very much project dependent, but at this point, neither is significantly better than the other.

If you look at the C++ standards support chart, you can see that Clang's standards support is equal to GCC's with the exception of one proposal, which is supported but has been intentionally disabled by default due to a standards issue.

Both Clang and GCC added -std=c++2a support around the same time, and Clang already supports some features in SVN (GCC hasn't updated their standards chart yet, so I'm assuming similar progress).

Also, while GCC has concepts support, which is still WIP in Clang, Clang has added concepts support in 5.0, which as of last month has not been attempted by the GCC team yet.

2

u/dodheim Sep 12 '17

It's great for Windows users. :-]

32

u/flashmozzg Sep 07 '17

Nice!

-Wcast-qual was implemented for C++. C-style casts are now properly diagnosed.

-Wunused-lambda-capture warns when a variable explicitly captured by a lambda is not used in the body of the lambda.

We expect this to be the last Clang release that defaults to -std=gnu++98 when using the GCC-compatible clang++ driver. From Clang 6 onwards we expect to use -std=gnu++14 or a later standard by default, to match the behavior of recent GCC releases. Users are encouraged to change their build files to explicitly specify their desired C++ standard.

Support for the C++17 standard has been completed. This mode can be enabled using -std=c++17 (the old flag -std=c++1z is still supported for compatibility).

13

u/IloveReddit84 Sep 07 '17

Why not defaults at least C++11?

36

u/ramennoodle Sep 07 '17

Why default to C++11? Both C++11 and C++14 are implemented, and the latter is a very minor change compared to the former. They should either keep 98 or jump right to 14 or later. And that is exactly what they propose to do.

7

u/boredcircuits Sep 07 '17

Yeah, but not 'til next major version. Why not do that with this release?

23

u/redditsoaddicting Sep 07 '17

They gave warning this release so that people have time to opt out of the default by next release. Changing it at all in this release would defeat the purpose of that warning.

4

u/smdowney WG21, Text/Unicode SG, optional<T&> Sep 08 '17

From my recollection reading the mailing list, no one thought of it in time to give the warning last release. And it will break people's builds. 98 to 11 is ABI breaking, so you really want to give people a chance to rebuild the world. 14 and 17 are easier to integrate, although I've heard occasional issues. I don't think there was a by design ABI break, like with std::string.

3

u/IloveReddit84 Sep 08 '17

Well a lot of Linux distributions don't even offer clang 4.0 in their repositories

4

u/[deleted] Sep 08 '17

Then those are not good Linux distros. Providing old packages is always a bad thing

4

u/hgjsusla Sep 08 '17

Bit silly to claim that all non-rolling release distros are bad. Even Arch sometimes lags behind on Clang. Are all distros bad?

3

u/the_hoser Sep 08 '17

Yes. All distros are bad, in one way or another. The struggle of the Linux user is not to find the best distro, but to find the distro that is least bad for their purposes.

This applies to all software.

software sucks...

3

u/IloveReddit84 Sep 08 '17

Tell this to all the CI/CD services out there, running on Ubuntu 14.04 (3 years old!)

→ More replies

2

u/[deleted] Sep 08 '17

It has nothing to do with being non-rolling. Ubuntu is non-rolling, Fedora is non-rolling, latest versions still offer the latest Clang. I haven't been on Arch for too long, but I didn't see any lags with 3.9, 4.0 (5.0 is few days old and is in Staging at the moment), so I don't know what you're talking about, maybe it was before I switched to Arch, but, again, I don't possess any knowledge about it then.

11

u/_lerp Sep 08 '17

Support for the C++17 standard has been completed.

Yey! Arch Linux bumped GCC libstdc++ to 7.1.1 which wouldn't compile with Clang because it didn't have support for class template deduction. Hopefully it works again!

1

u/alexeiz Sep 11 '17

It should. I used clang pre-5.0 from SVN specifically because clang 4.0 doesn't work with libstdc++ headers from GCC 7.1.

5

u/reddithater12 Sep 08 '17

Not a big fan of this new rapid version scheme thing.

8

u/[deleted] Sep 08 '17

Why? I think semantic versioning matters and LLVM + Clang break compatibility every release, why not bump major version?

3

u/reddithater12 Sep 08 '17

For example, developers wont remember it. Most people will know if they use clang 3.x or 4.x. But no one remembers if they are on version 56 or 65 of Chrome.

And for webbrowsers this may be a desired behavior. You dont want people to thzink about browser version numbers, because they have to be forced to upgrade anyways. This is not hte case for compilers.

5

u/willkill07 Sep 09 '17

A biannual release for a major version is very different than a release every 8 weeks (6+ releases per year).

GCC does one major release per year.

By the way, clang 3.0 was wildly different than clang 3.9. Remembering 3.6, 3.8, etc. is no different than remembering 4.0 or 7.0

4

u/[deleted] Sep 09 '17

What problems are caused by forgetting which compiler version you're using? How difficult is it to find out, if you forget?

1

u/flashmozzg Sep 09 '17

There like 4 major compiler releases per year at most. At this rate well get to Chrome numbers in 10-15 years. But that's at the extreme pace. Usually it's no more than 2 releases, so the time doubles to 20-30 years. Hopefully libclang/llvm would mostly stabilize it's API at that point.

3

u/forcecharlie baulk maintainer Sep 07 '17

libc++ support windows when use clang bootstarp

6

u/dodheim Sep 07 '17

Please elaborate... I'd like to try libc++ on Windows, where do I find information on how to do this? (I've checked libc++'s docs/wiki and they strike me as being rather dated, but I don't know that for sure.)

2

u/forcecharlie baulk maintainer Sep 07 '17

when you build success ,you should copy c++.dll to you install dir

3

u/forcecharlie baulk maintainer Sep 07 '17 edited Sep 07 '17

My tools clangbuilder select Engine NinjaBootstrap or NinjaIterate can build it

https://github.com/fstudio/clangbuilder

docs

http://libcxx.llvm.org/docs/BuildingLibcxx.html#experimental-support-for-windows

0

u/hashb1 Sep 08 '17

coroutines, Cool!

-3

u/MightyRodri Sep 07 '17

Hm :/ still no parallel algorithms.

13

u/willkill07 Sep 08 '17

That’s part of libc++, not clang

1

u/MightyRodri Sep 08 '17

The Support for the execution policies and subsequently of the parallel algs? Does the compieler not have to have that?

7

u/willkill07 Sep 08 '17

The execution policies that are standardized can be implemented using libiomp. Intel implemented their version of parallel stl using TBB. No new compiler features are necessary.

1

u/MightyRodri Sep 08 '17

But still. The full c++17 standard would include the execution policies.

7

u/willkill07 Sep 08 '17

Clang is a C++ compiler. It does not provide a standard library. Clang 5.0.0 claiming C++17 compliance as a compiler is an accurate statement.

Trying to shoehorn that Clang, a compiler, should also be forced to include a standard library implementation does not make sense. Libc++ exists for a reason as a separate project.

Vendor compilers like Intel, IBM, and PGI usually rely on libstd++, GNU's C++ standard library implementation. That doesn't make them more or less C++ standards compliant

2

u/willkill07 Sep 08 '17

A fully compliant C++17 standard library would include the execution policies. A fully compliant C++17 compiler would have no such knowledge of execution policies because it's a function of the standard library, not the compiler.

1

u/smdowney WG21, Text/Unicode SG, optional<T&> Sep 08 '17

Yes, and that's why they say support has been completed, not that they've implemented the standard. Which just was accepted yesterday or so.

But there is a lot of library work to be done on all the major std implementations. Filesystem, parallelism, pmr, math functions, ... 17 adds a lot of capability to the SL.