| OLD | NEW |
| 1 ========================= | 1 ========================= |
| 2 Clang Language Extensions | 2 Clang Language Extensions |
| 3 ========================= | 3 ========================= |
| 4 | 4 |
| 5 .. contents:: | 5 .. contents:: |
| 6 :local: | 6 :local: |
| 7 :depth: 1 | 7 :depth: 1 |
| 8 | 8 |
| 9 .. toctree:: | 9 .. toctree:: |
| 10 :hidden: | 10 :hidden: |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 Use ``__has_feature(cxx_user_literals)`` to determine if support for | 772 Use ``__has_feature(cxx_user_literals)`` to determine if support for |
| 773 user-defined literals is enabled. | 773 user-defined literals is enabled. |
| 774 | 774 |
| 775 C++11 variadic templates | 775 C++11 variadic templates |
| 776 ^^^^^^^^^^^^^^^^^^^^^^^^ | 776 ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 777 | 777 |
| 778 Use ``__has_feature(cxx_variadic_templates)`` or | 778 Use ``__has_feature(cxx_variadic_templates)`` or |
| 779 ``__has_extension(cxx_variadic_templates)`` to determine if support for | 779 ``__has_extension(cxx_variadic_templates)`` to determine if support for |
| 780 variadic templates is enabled. | 780 variadic templates is enabled. |
| 781 | 781 |
| 782 C++1y | |
| 783 ----- | |
| 784 | |
| 785 The features listed below are part of the committee draft for the C++1y | |
| 786 standard. As a result, all these features are enabled with the ``-std=c++1y`` | |
| 787 or ``-std=gnu++1y`` option when compiling C++ code. | |
| 788 | |
| 789 C++1y binary literals | |
| 790 ^^^^^^^^^^^^^^^^^^^^^ | |
| 791 | |
| 792 Use ``__has_feature(cxx_binary_literals)`` or | |
| 793 ``__has_extension(cxx_binary_literals)`` to determine whether | |
| 794 binary literals (for instance, ``0b10010``) are recognized. Clang supports this | |
| 795 feature as an extension in all language modes. | |
| 796 | |
| 797 C++1y contextual conversions | |
| 798 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 799 | |
| 800 Use ``__has_feature(cxx_contextual_conversions)`` or | |
| 801 ``__has_extension(cxx_contextual_conversions)`` to determine if the C++1y rules | |
| 802 are used when performing an implicit conversion for an array bound in a | |
| 803 *new-expression*, the operand of a *delete-expression*, an integral constant | |
| 804 expression, or a condition in a ``switch`` statement. Clang does not yet | |
| 805 support this feature. | |
| 806 | |
| 807 C++1y decltype(auto) | |
| 808 ^^^^^^^^^^^^^^^^^^^^ | |
| 809 | |
| 810 Use ``__has_feature(cxx_decltype_auto)`` or | |
| 811 ``__has_extension(cxx_decltype_auto)`` to determine if support | |
| 812 for the ``decltype(auto)`` placeholder type is enabled. | |
| 813 | |
| 814 C++1y default initializers for aggregates | |
| 815 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 816 | |
| 817 Use ``__has_feature(cxx_aggregate_nsdmi)`` or | |
| 818 ``__has_extension(cxx_aggregate_nsdmi)`` to determine if support | |
| 819 for default initializers in aggregate members is enabled. | |
| 820 | |
| 821 C++1y generalized lambda capture | |
| 822 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 823 | |
| 824 Use ``__has_feature(cxx_generalized_capture)`` or | |
| 825 ``__has_extension(cxx_generalized_capture`` to determine if support for | |
| 826 generalized lambda captures is enabled | |
| 827 (for instance, ``[n(0)] { return ++n; }``). | |
| 828 Clang does not yet support this feature. | |
| 829 | |
| 830 C++1y generic lambdas | |
| 831 ^^^^^^^^^^^^^^^^^^^^^ | |
| 832 | |
| 833 Use ``__has_feature(cxx_generic_lambda)`` or | |
| 834 ``__has_extension(cxx_generic_lambda)`` to determine if support for generic | |
| 835 (polymorphic) lambdas is enabled | |
| 836 (for instance, ``[] (auto x) { return x + 1; }``). | |
| 837 Clang does not yet support this feature. | |
| 838 | |
| 839 C++1y relaxed constexpr | |
| 840 ^^^^^^^^^^^^^^^^^^^^^^^ | |
| 841 | |
| 842 Use ``__has_feature(cxx_relaxed_constexpr)`` or | |
| 843 ``__has_extension(cxx_relaxed_constexpr)`` to determine if variable | |
| 844 declarations, local variable modification, and control flow constructs | |
| 845 are permitted in ``constexpr`` functions. | |
| 846 Clang's implementation of this feature is incomplete. | |
| 847 | |
| 848 C++1y return type deduction | |
| 849 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 850 | |
| 851 Use ``__has_feature(cxx_return_type_deduction)`` or | |
| 852 ``__has_extension(cxx_return_type_deduction)`` to determine if support | |
| 853 for return type deduction for functions (using ``auto`` as a return type) | |
| 854 is enabled. | |
| 855 Clang's implementation of this feature is incomplete. | |
| 856 | |
| 857 C++1y runtime-sized arrays | |
| 858 ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 859 | |
| 860 Use ``__has_feature(cxx_runtime_array)`` or | |
| 861 ``__has_extension(cxx_runtime_array)`` to determine if support | |
| 862 for arrays of runtime bound (a restricted form of variable-length arrays) | |
| 863 is enabled. | |
| 864 Clang's implementation of this feature is incomplete. | |
| 865 | |
| 866 C++1y variable templates | |
| 867 ^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 868 | |
| 869 Use ``__has_feature(cxx_variable_templates)`` or | |
| 870 ``__has_extension(cxx_variable_templates)`` to determine if support for | |
| 871 templated variable declarations is enabled. | |
| 872 Clang does not yet support this feature. | |
| 873 | |
| 874 C11 | 782 C11 |
| 875 --- | 783 --- |
| 876 | 784 |
| 877 The features listed below are part of the C11 standard. As a result, all these | 785 The features listed below are part of the C11 standard. As a result, all these |
| 878 features are enabled with the ``-std=c11`` or ``-std=gnu11`` option when | 786 features are enabled with the ``-std=c11`` or ``-std=gnu11`` option when |
| 879 compiling C code. Additionally, because these features are all | 787 compiling C code. Additionally, because these features are all |
| 880 backward-compatible, they are available as extensions in all language modes. | 788 backward-compatible, they are available as extensions in all language modes. |
| 881 | 789 |
| 882 C11 alignment specifiers | 790 C11 alignment specifiers |
| 883 ^^^^^^^^^^^^^^^^^^^^^^^^ | 791 ^^^^^^^^^^^^^^^^^^^^^^^^ |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 void foo(const char* s, char *buf, ...) { | 2002 void foo(const char* s, char *buf, ...) { |
| 2095 va_list ap; | 2003 va_list ap; |
| 2096 va_start(ap, buf); | 2004 va_start(ap, buf); |
| 2097 | 2005 |
| 2098 vprintf(s, ap); // warning | 2006 vprintf(s, ap); // warning |
| 2099 } | 2007 } |
| 2100 | 2008 |
| 2101 In this case Clang does not warn because the format string ``s`` and | 2009 In this case Clang does not warn because the format string ``s`` and |
| 2102 the corresponding arguments are annotated. If the arguments are | 2010 the corresponding arguments are annotated. If the arguments are |
| 2103 incorrect, the caller of ``foo`` will receive a warning. | 2011 incorrect, the caller of ``foo`` will receive a warning. |
| OLD | NEW |