| RFC-0193: Supported C++ Versions ||
|---|---|
| Status | Accepted |
| Areas | - Build - Developer - Toolchain |
| Description | Drop C++14 support from the SDK and clarify how support for C++ versions will be decided and supported in the future. |
| Gerrit change | - [705630](https://fuchsia-review.googlesource.com/c/fuchsia/+/705630) |
| Authors | - [ianloic@google.com](https://fuchsia-review.googlesource.com/q/owner:ianloic@google.com) |
| Reviewers | - [johngro@google.com](https://fuchsia-review.googlesource.com/q/owner:johngro@google.com) - [dschuyler@google.com](https://fuchsia-review.googlesource.com/q/owner:dschuyler@google.com) - [abarth@google.com](https://fuchsia-review.googlesource.com/q/owner:abarth@google.com) |
| Date submitted (year-month-day) | 2022-07-29 |
| Date reviewed (year-month-day) | 2022-10-03 |

[Edit this RFC](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/contribute/governance/rfcs/0193_supported_c++_versions.md)
[Edit RFC metadata](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/contribute/governance/rfcs/_rfcs.yaml&searchAndJump=-+name:+'RFC-0193')

## Summary

Drop C++14 support from the SDK and clarify how support for C++ versions will be
decided and supported in the future.

## Motivation

The C++ SDK currently [claims to support C++14](https://fuchsia.dev/docs/development/idk/documentation/compilation) but there aren't
effective tests in the Fuchsia tree to prevent C++14 incompatible code from
making its way into the SDK. This breaks users and results in roll-backs.

The Fuchsia tree is built with C++17. Many libraries and frameworks in the
Fuchsia tree that would be useful for out of tree developers depend on C++17
features. In particular the new FIDL C++ bindings require C++17.

There are no longer any users of the SDK that compile as C++14 so changing the
supported version is just a matter of changing the documentation.

## Stakeholders

*Facilitator:* cpu@google.com

*Reviewers:* johngro@google.com, dschuyler@google.com, abarth@google.com

*Consulted:* yifeit@google.com, sebmarchand@google.com, phosek@google.com,
eieio@google.com, schottm@google.com, jamesr@google.com, gevalentino@google.com,
jyknight@google.com

## Design

### Terminology

A *C++ version* refers to a revision of the [ISO C++ standard](https://isocpp.org/std/the-standard). We
refer to it by short-hand like *C++14* , *C++17* , *C++20*, etc.

The *SDK C++ versions* is a list of *C++ versions* that are
[documented](https://fuchsia.dev/docs/development/idk/documentation/compilation) to be supported by the Fuchsia SDK and are used by
the build systems shipped as part of the SDK. That list currently includes
*C++14* and *C++17*.

### Dropping C++14

The [SDK documentation](https://fuchsia.dev/docs/development/idk/documentation/compilation) and [C++ in Zircon](https://fuchsia.dev/docs/development/languages/c-cpp/cxx) SHALL
be updated to reflect that C++14 is no longer supported.

### Fuchsia Tree C++ Version

The *C++ version* used to compile most code that runs on Fuchsia in the Fuchsia
tree MUST be an *SDK C++ version* . Other *C++ versions* MAY be used in the
Fuchsia tree for small, isolated codebases or for host-only code, but this is
discouraged.

### C++ Version Testing

A core set of tests MUST be built and run for every *SDK C++ version* as part of
the Fuchsia commit queue. This set of tests includes all C++ tests in the CTS
and API tests for C++ FIDL bindings, but may include more.

### Adding C++ Versions

A new *SDK C++ version* may be added by writing an RFC to propse that addition
and having it approved.

Only *C++ versions* that are published by the ISO C++ committee may be added to
the C++ versions.

As part of adding an *SDK C++ version* the Fuchsia build MUST be updated to
build and run the C++ tests identified above with the added *C++ version*.

### Removing C++ Versions

_SDK C++ version_s may be removed by writing an RFC to propose that removal and
having it approved.

When removing an *SDK C++ version* it MUST be removed from the SDK documentation
and SHOULD be removed from the Fuchsia build system.

## Implementation

### Dropping C++14

This is just a documentation change.

### C++ Version Testing

After *C++14* is dropped *C++17* will be the only *SDK C++ version* . Tests are
already built and run with *C++17*.

Before another version can be added the Fuchsia build system will need to be
updated to allow tests to be built and run with multiple *C++ versions*.

## Performance

N/A

## Ergonomics

It will be much easier to update C++ code that is shipped in the SDK because
every change will be tested against every supported C++ version.

## Backwards Compatibility

All current (in October 2022) Fuchsia users build with C++17 so there are no
backwards compatibility issues.

## Security considerations

N/A

## Privacy considerations

N/A

## Testing

See above.

## Documentation

The [SDK documentation](https://fuchsia.dev/docs/development/idk/documentation/compilation) and [C++ in Zircon](https://fuchsia.dev/docs/development/languages/c-cpp/cxx) will
be updated to reflect that C++14 is no longer supported.

This RFC serves as the documentation for the policy for adding and removing *C++
versions* in the future.

## Drawbacks, alternatives, and unknowns

## Prior art and references

[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/contribute/governance/rfcs/0193_supported_c++_versions.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/contribute/governance/rfcs/0193_supported_c++_versions.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/contribute/governance/rfcs/0193_supported_c++_versions.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/contribute/governance/rfcs/0193_supported_c++_versions.md "Edit the source code of this page")