|  | 
|  | 1 | +<!-- {% raw %} --> | 
|  | 2 | + | 
|  | 3 | +# Adopt C++11 Base | 
|  | 4 | + | 
|  | 5 | +* Proposal: [NNNN](NNNN-cxx11-base.md) | 
|  | 6 | +* Author(s): [Chris Bieneman](https://github.com/llvm-beanz) | 
|  | 7 | +* Sponsor: TBD | 
|  | 8 | +* Status: **Under Consideration** | 
|  | 9 | +* Planned Version: 202y | 
|  | 10 | + | 
|  | 11 | +## Introduction | 
|  | 12 | + | 
|  | 13 | +In DXC HLSL is a set of feature extensions on top of a subset of C++98. C++98 | 
|  | 14 | +is now over 20 years old and most modern C++ users have adopted newer language | 
|  | 15 | +constructs. This proposal suggests taking the small step of updating HLSL 202y's | 
|  | 16 | +base C++ language to C++11. | 
|  | 17 | + | 
|  | 18 | +## Motivation | 
|  | 19 | + | 
|  | 20 | +C++11 is over a decade old and introduced widely adopted features, many of which | 
|  | 21 | +have been frequently requested additions for HLSL. | 
|  | 22 | + | 
|  | 23 | +## Proposed solution | 
|  | 24 | + | 
|  | 25 | +Adopt a C++11 base language and include the following C++11 features in HLSL 202y: | 
|  | 26 | +* auto | 
|  | 27 | +* decltype | 
|  | 28 | +* constexpr | 
|  | 29 | +* C++11 scoped enumerations | 
|  | 30 | +* variadic templates | 
|  | 31 | +* user-defined literals | 
|  | 32 | +* [C++11 attributes](/proposals/0002-cxx-attributes.md) | 
|  | 33 | +* Lambda expressions | 
|  | 34 | +* Static assert | 
|  | 35 | +* Range-based for loops | 
|  | 36 | + | 
|  | 37 | +## Alternatives considered | 
|  | 38 | + | 
|  | 39 | +### C++20 | 
|  | 40 | + | 
|  | 41 | +We could instead adopt an even more recent C++, like C++20. The main drawback of | 
|  | 42 | +that is that it significantly increases the rapid divergence from DXC, and it | 
|  | 43 | +gives us a longer list of features that we need to rectify against HLSL's | 
|  | 44 | +language features. Adopting a C++11 base for 202y does not prevent later | 
|  | 45 | +versions from adopting newer C++ base standards, but it does allow us to phase | 
|  | 46 | +the changes in iteratively as HLSL evolves. | 
|  | 47 | + | 
|  | 48 | +### Target HLSL 202x | 
|  | 49 | + | 
|  | 50 | +While the original Clang 3.7 release did support C++11 fully, the intrusive | 
|  | 51 | +changes to support HLSL broke many of the basic features Clang uses for | 
|  | 52 | +configuring language features and supporting language modes. To restore those | 
|  | 53 | +parts of clang sufficiently to support a C++11 base in DXC would be non-trivial. | 
|  | 54 | +For that reason this is proposed as a Clang-only HLSL 202y feature. | 
|  | 55 | + | 
|  | 56 | +<!-- {% endraw %} --> | 
0 commit comments