[llvm-dev] Using C++14 code in LLVM

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 3 10:38:32 PDT 2016


Zachary Turner via llvm-dev <llvm-dev at lists.llvm.org> writes:
> A thread was started over the summer to discuss the timeline for bumping
> LLVM up to Visual Studio 2015 to enable the use of various new language
> features.  Currently the ETA for this is sometime in mid-October, so within
> 2-3 weeks.
>
> With this happening imminently, I thought it would be worth tossing this
> out there and seeing what people think.
>
> With VS on 2015, the major lagging compiler is going to be GCC.  Our
> minimum GCC requirement is 4.7, which is quite old (almost 4 years for
> anyone keeping count).  What are the challenges with pushing this forward?
>
> With VS2015, the biggest remaining missing C++14 features are variable
> templates, sized allocation, and extended constexpr.  But it gains generic
> lambdas, init-captures, decltype(auto) return, and auto return without
> requiring the trailing -> decltype syntax.

I'm not convinced that the cost is worth the gain for these features.
Most of these are relatively straight forward (with more boilerplate) to
work around in C++11, and I'd rather we not get into a situation where
to bootstrap clang you need to build a C++11 compatible version so that
you can build a C++14 compatible one so that you can build a C++17
compatible one, etc. Consider that -std=c++17 isn't yet a valid flag on
trunk clang, so if we bump to C++14 now then we're practically
guaranteed that when we want to update to 17 we'll run into multi-stage
bootstrapping problems.

> While GCC doesn't claim to "fully" support C++14 until 5.2 (which is only
> about 1 year old), you can get all of the above features with GCC 4.9
>
> So if we're willing to allow "partial" C++14 support in LLVM (i.e a
> whitelisted set of features), we may be able to get many of the most useful
> features by going to GCC 4.9, which is still a good 2.5 years old.

I'd be much happier getting to requiring "full" C++11 support than going
to partial C++14 support - having partial support for C++11 has meant
that many issues are only caught by bots, and I much prefer the compiler
to complain when I use some feature we're not allowed to use yet.

> One potentially added benefit of this is that GCC supports <regex> in 4.9.
> This might allow us to kill of llvm::Regex in favor of standardizing on
> std::regex, as GCC is currently the only supported compiler without a regex
> implementation.
>
> Thoughts?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list