Use of C++17 in the LLVM codebase

Making better use of C++17 came up several times in devmtg chats this year.

I notice we have a number of cases in LLVM source which allows (optional) use of C++17, but it is never mandatory or assumed:

e.g StringRef.h

#if __cplusplus > 201402L
#include <string_view>


 // Constexpr version of std::strlen\.
 static constexpr size\_t strLen\(const char \*Str\) \{

#if __cplusplus > 201402L
return std::char_traits<char>::length(Str);
#elif __has_builtin(__builtin_strlen) || defined(__GNUC__) || \
(defined(_MSC_VER) && _MSC_VER >= 1916)
return __builtin_strlen(Str);
const char *Begin = Str;
while (*Str != '\0')
return Str - Begin;

According to LLVM Coding Standards — LLVM 16.0.0git documentation - we only accept up to standard C++14 code that is supported by our minimum gcc/clang/msvc versions.

Does anyone know what in particular is preventing us from bumping the minimum compiler versions to make 'compiler supported' C++17 a similar requirement to build LLVM at this time?

AFAICT, the last time this was discussed (back in 2018/9), some developers still had a dependency on Ubuntu 1604 LTS (and other old distros), whose default gcc didn't have adequate C++17 support. Support for 1604 has been extended to April 2026 - I'm guessing we're not going to wait until then?

Cheers, Simon.

There is a process for this that's documented here:

An RFC like this should be written:

I don't think anything is blocking it except that someone needs to do
the work to investigate the different toolchains and summarize it in a
RFC email to the list.

-- Tobias