1 ===========================================
2 Clang |release| |ReleaseNotesTitle|
3 ===========================================
9 Written by the `LLVM Team <https://llvm.org/>`_
14 These are in-progress notes for the upcoming Clang |version| release.
15 Release notes for previous releases can be found on
16 `the Releases Page <https://llvm.org/releases/>`_.
21 This document contains the release notes for the Clang C/C++/Objective-C
22 frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
23 describe the status of Clang in some detail, including major
24 improvements from the previous release and new feature work. For the
25 general LLVM release notes, see `the LLVM
26 documentation <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ release notes,
27 see `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases
28 may be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
30 For more information about Clang or LLVM, including information about the
31 latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
32 `LLVM Web Site <https://llvm.org>`_.
34 Potentially Breaking Changes
35 ============================
36 These changes are ones which we think may surprise users when upgrading to
37 Clang |release| because of the opportunity they pose for disruption to existing
41 C/C++ Language Potentially Breaking Changes
42 -------------------------------------------
44 - The default extension name for PCH generation (``-c -xc-header`` and ``-c
45 -xc++-header``) is now ``.pch`` instead of ``.gch``.
46 - ``-include a.h`` probing ``a.h.gch`` will now ignore ``a.h.gch`` if it is not
47 a clang pch file or a directory containing any clang pch file.
48 - Fixed a bug that caused ``__has_cpp_attribute`` and ``__has_c_attribute``
49 return incorrect values for some C++-11-style attributes. Below is a complete
50 list of behavior changes.
53 :header: Test, Old value, New value
55 ``__has_cpp_attribute(unused)``, 201603, 0
56 ``__has_cpp_attribute(gnu::unused)``, 201603, 1
57 ``__has_c_attribute(unused)``, 202106, 0
58 ``__has_cpp_attribute(clang::fallthrough)``, 201603, 1
59 ``__has_cpp_attribute(gnu::fallthrough)``, 201603, 1
60 ``__has_c_attribute(gnu::fallthrough)``, 201910, 1
61 ``__has_cpp_attribute(warn_unused_result)``, 201907, 0
62 ``__has_cpp_attribute(clang::warn_unused_result)``, 201907, 1
63 ``__has_cpp_attribute(gnu::warn_unused_result)``, 201907, 1
64 ``__has_c_attribute(warn_unused_result)``, 202003, 0
65 ``__has_c_attribute(gnu::warn_unused_result)``, 202003, 1
67 - Fixed a bug in finding matching `operator!=` while adding reversed `operator==` as
68 outlined in "The Equality Operator You Are Looking For" (`P2468 <http://wg21.link/p2468r2>`_).
69 Fixes (`#68901: <https://github.com/llvm/llvm-project/issues/68901>`_).
71 C++ Specific Potentially Breaking Changes
72 -----------------------------------------
73 - The name mangling rules for function templates has been changed to take into
74 account the possibility that functions could be overloaded on their template
75 parameter lists or requires-clauses. This causes mangled names to change for
76 function templates in the following cases:
78 - When a template parameter in a function template depends on a previous
79 template parameter, such as ``template<typename T, T V> void f()``.
80 - When the function has any constraints, whether from constrained template
81 parameters or requires-clauses.
82 - When the template parameter list includes a deduced type -- either
83 ``auto``, ``decltype(auto)``, or a deduced class template specialization
85 - When a template template parameter is given a template template argument
86 that has a different template parameter list.
88 This fixes a number of issues where valid programs would be rejected due to
89 mangling collisions, or would in some cases be silently miscompiled. Clang
90 will use the old manglings if ``-fclang-abi-compat=17`` or lower is
92 (`#48216 <https://github.com/llvm/llvm-project/issues/48216>`_),
93 (`#49884 <https://github.com/llvm/llvm-project/issues/49884>`_), and
94 (`#61273 <https://github.com/llvm/llvm-project/issues/61273>`_)
96 - The `ClassScopeFunctionSpecializationDecl` AST node has been removed.
97 Dependent class scope explicit function template specializations now use
98 `DependentFunctionTemplateSpecializationInfo` to store candidate primary
99 templates and explicit template arguments. This should not impact users of
100 Clang as a compiler, but it may break assumptions in Clang-based tools
101 iterating over the AST.
103 - The warning `-Wenum-constexpr-conversion` is now also enabled by default on
104 system headers and macros. It will be turned into a hard (non-downgradable)
105 error in the next Clang release.
107 - The flag `-fdelayed-template-parsing` won't be enabled by default with C++20
108 when targetting MSVC to match the behavior of MSVC.
109 (`MSVC Docs <https://learn.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-170>`_)
111 ABI Changes in This Version
112 ---------------------------
113 - Following the SystemV ABI for x86-64, ``__int128`` arguments will no longer
114 be split between a register and a stack slot.
116 AST Dumping Potentially Breaking Changes
117 ----------------------------------------
118 - When dumping a sugared type, Clang will no longer print the desugared type if
119 its textual representation is the same as the sugared one. This applies to
120 both text dumps of the form ``'foo':'foo'`` which will now be dumped as just
121 ``'foo'``, and JSON dumps of the form:
127 "desugaredQualType": "foo"
130 which will now be dumped as just:
138 What's New in Clang |release|?
139 ==============================
140 Some of the major new features and improvements to Clang are listed
141 here. Generic improvements to Clang as a whole or to its underlying
142 infrastructure are described first, followed by language-specific
143 sections with improvements to Clang's support for those languages.
148 C++20 Feature Support
149 ^^^^^^^^^^^^^^^^^^^^^
151 C++23 Feature Support
152 ^^^^^^^^^^^^^^^^^^^^^
153 - Implemented `P0847R7: Deducing this <https://wg21.link/P0847R7>`_. Some related core issues were also
154 implemented (`CWG2553 <https://wg21.link/CWG2553>`_, `CWG2554 <https://wg21.link/CWG2554>`_,
155 `CWG2653 <https://wg21.link/CWG2653>`_, `CWG2687 <https://wg21.link/CWG2687>`_). Because the
156 support for this feature is still experimental, the feature test macro ``__cpp_explicit_this_parameter``
157 was not set in this version.
159 C++2c Feature Support
160 ^^^^^^^^^^^^^^^^^^^^^
162 - Implemented `P2169R4: A nice placeholder with no name <https://wg21.link/P2169R4>`_. This allows using ``_``
163 as a variable name multiple times in the same scope and is supported in all C++ language modes as an extension.
164 An extension warning is produced when multiple variables are introduced by ``_`` in the same scope.
165 Unused warnings are no longer produced for variables named ``_``.
166 Currently, inspecting placeholders variables in a debugger when more than one are declared in the same scope
172 int _, _; // Was invalid, now OK
175 int _, _; // Was invalid, now OK
178 int _; // Previously diagnosed under -Wunused, no longer diagnosed
181 - Attributes now expect unevaluated strings in attributes parameters that are string literals.
182 This is applied to both C++ standard attributes, and other attributes supported by Clang.
183 This completes the implementation of `P2361R6 Unevaluated Strings <https://wg21.link/P2361R6>`_
186 Resolutions to C++ Defect Reports
187 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191 - ``structs``, ``unions``, and ``arrays`` that are const may now be used as
192 constant expressions. This change is more consistent with the behavior of
194 - Clang now supports the C-only attribute ``counted_by``. When applied to a
195 struct's flexible array member, it points to the struct field that holds the
196 number of elements in the flexible array member. This information can improve
197 the results of the array bound sanitizer and the
198 ``__builtin_dynamic_object_size`` builtin.
202 - Clang now accepts ``-std=c23`` and ``-std=gnu23`` as language standard modes,
203 and the ``__STDC_VERSION__`` macro now expands to ``202311L`` instead of its
204 previous placeholder value. Clang continues to accept ``-std=c2x`` and
205 ``-std=gnu2x`` as aliases for C23 and GNU C23, respectively.
206 - Clang now supports `requires c23` for module maps.
207 - Clang now supports ``N3007 Type inference for object definitions``.
209 - Clang now supports ``<stdckdint.h>`` which defines several macros for performing
210 checked integer arithmetic. It is also exposed in pre-C23 modes.
212 Non-comprehensive list of changes in this release
213 -------------------------------------------------
215 * Clang now has a ``__builtin_vectorelements()`` function that determines the number of elements in a vector.
216 For fixed-sized vectors, e.g., defined via ``__attribute__((vector_size(N)))`` or ARM NEON's vector types
217 (e.g., ``uint16x8_t``), this returns the constant number of elements at compile-time.
218 For scalable vectors, e.g., SVE or RISC-V V, the number of elements is not known at compile-time and is
219 determined at runtime.
224 * ``-fverify-intermediate-code`` and its complement ``-fno-verify-intermediate-code``.
225 Enables or disables verification of the generated LLVM IR.
226 Users can pass this to turn on extra verification to catch certain types of
227 compiler bugs at the cost of extra compile time.
228 Since enabling the verifier adds a non-trivial cost of a few percent impact on
229 build times, it's disabled by default, unless your LLVM distribution itself is
230 compiled with runtime checks enabled.
231 * ``-fkeep-system-includes`` modifies the behavior of the ``-E`` option,
232 preserving ``#include`` directives for "system" headers instead of copying
233 the preprocessed text to the output. This can greatly reduce the size of the
234 preprocessed output, which can be helpful when trying to reduce a test case.
236 Deprecated Compiler Flags
237 -------------------------
239 Modified Compiler Flags
240 -----------------------
242 * ``-Woverriding-t-option`` is renamed to ``-Woverriding-option``.
243 * ``-Winterrupt-service-routine`` is renamed to ``-Wexcessive-regsave`` as a generalization
244 * ``-frewrite-includes`` now guards the original #include directives with
245 ``__CLANG_REWRITTEN_INCLUDES``, and ``__CLANG_REWRITTEN_SYSTEM_INCLUDES`` as
247 * Introducing a new default calling convention for ``-fdefault-calling-conv``:
248 ``rtdcall``. This new default CC only works for M68k and will use the new
249 ``m68k_rtdcc`` CC on every functions that are not variadic. The ``-mrtd``
250 driver/frontend flag has the same effect when targeting M68k.
252 Removed Compiler Flags
253 -------------------------
255 * ``-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang`` has been removed.
256 It has not been needed to enable ``-ftrivial-auto-var-init=zero`` since Clang 16.
258 Attribute Changes in Clang
259 --------------------------
260 - On X86, a warning is now emitted if a function with ``__attribute__((no_caller_saved_registers))``
261 calls a function without ``__attribute__((no_caller_saved_registers))``, and is not compiled with
262 ``-mgeneral-regs-only``
263 - On X86, a function with ``__attribute__((interrupt))`` can now call a function without
264 ``__attribute__((no_caller_saved_registers))`` provided that it is compiled with ``-mgeneral-regs-only``
266 - When a non-variadic function is decorated with the ``format`` attribute,
267 Clang now checks that the format string would match the function's parameters'
268 types after default argument promotion. As a result, it's no longer an
269 automatic diagnostic to use parameters of types that the format style
270 supports but that are never the result of default argument promotion, such as
271 ``float``. (`#59824: <https://github.com/llvm/llvm-project/issues/59824>`_)
273 - Clang now supports ``[[clang::preferred_type(type-name)]]`` as an attribute
274 which can be applied to a bit-field. This attribute helps to map a bit-field
275 back to a particular type that may be better-suited to representing the bit-
276 field but cannot be used for other reasons and will impact the debug
277 information generated for the bit-field. This is most useful when mapping a
278 bit-field of basic integer type back to a ``bool`` or an enumeration type,
283 enum E { Apple, Orange, Pear };
285 [[clang::preferred_type(E)]] unsigned FruitKind : 2;
288 When viewing ``S::FruitKind`` in a debugger, it will behave as if the member
289 was declared as type ``E`` rather than ``unsigned``.
291 Improvements to Clang's diagnostics
292 -----------------------------------
293 - Clang constexpr evaluator now prints template arguments when displaying
294 template-specialization function calls.
295 - Clang contexpr evaluator now displays notes as well as an error when a constructor
296 of a base class is not called in the constructor of its derived class.
297 - Clang no longer emits ``-Wmissing-variable-declarations`` for variables declared
298 with the ``register`` storage class.
299 - Clang's ``-Wtautological-negation-compare`` flag now diagnoses logical
300 tautologies like ``x && !x`` and ``!x || x`` in expressions. This also
301 makes ``-Winfinite-recursion`` diagnose more cases.
302 (`#56035: <https://github.com/llvm/llvm-project/issues/56035>`_).
303 - Clang constexpr evaluator now diagnoses compound assignment operators against
304 uninitialized variables as a read of uninitialized object.
305 (`#51536 <https://github.com/llvm/llvm-project/issues/51536>`_)
306 - Clang's ``-Wformat-truncation`` now diagnoses ``snprintf`` call that is known to
307 result in string truncation.
308 (`#64871: <https://github.com/llvm/llvm-project/issues/64871>`_).
309 Existing warnings that similarly warn about the overflow in ``sprintf``
310 now falls under its own warning group ```-Wformat-overflow`` so that it can
311 be disabled separately from ``Wfortify-source``.
312 These two new warning groups have subgroups ``-Wformat-truncation-non-kprintf``
313 and ``-Wformat-overflow-non-kprintf``, respectively. These subgroups are used when
314 the format string contains ``%p`` format specifier.
315 Because Linux kernel's codebase has format extensions for ``%p``, kernel developers
316 are encouraged to disable these two subgroups by setting ``-Wno-format-truncation-non-kprintf``
317 and ``-Wno-format-overflow-non-kprintf`` in order to avoid false positives on
319 Also clang no longer emits false positive warnings about the output length of
320 ``%g`` format specifier and about ``%o, %x, %X`` with ``#`` flag.
321 - Clang now emits ``-Wcast-qual`` for functional-style cast expressions.
322 - Clang no longer emits irrelevant notes about unsatisfied constraint expressions
323 on the left-hand side of ``||`` when the right-hand side constraint is satisfied.
324 (`#54678: <https://github.com/llvm/llvm-project/issues/54678>`_).
325 - Clang now prints its 'note' diagnostic in cyan instead of black, to be more compatible
326 with terminals with dark background colors. This is also more consistent with GCC.
327 - The fix-it emitted by ``-Wformat`` for scoped enumerations now take the
328 enumeration's underlying type into account instead of suggesting a type just
329 based on the format string specifier being used.
330 - Clang now displays an improved diagnostic and a note when a defaulted special
331 member is marked ``constexpr`` in a class with a virtual base class
332 (`#64843: <https://github.com/llvm/llvm-project/issues/64843>`_).
333 - ``-Wfixed-enum-extension`` and ``-Wmicrosoft-fixed-enum`` diagnostics are no longer
334 emitted when building as C23, since C23 standardizes support for enums with a
335 fixed underlying type.
336 - When describing the failure of static assertion of `==` expression, clang prints the integer
337 representation of the value as well as its character representation when
338 the user-provided expression is of character type. If the character is
339 non-printable, clang now shows the escpaed character.
340 Clang also prints multi-byte characters if the user-provided expression
341 is of multi-byte character type.
347 static_assert("A\n"[1] == U'🌍');
353 source:1:15: error: static assertion failed due to requirement '"A\n"[1] == U'\U0001f30d''
354 1 | static_assert("A\n"[1] == U'🌍');
356 source:1:24: note: expression evaluates to ''
358 1 | static_assert("A\n"[1] == U'🌍');
365 source:1:15: error: static assertion failed due to requirement '"A\n"[1] == U'\U0001f30d''
366 1 | static_assert("A\n"[1] == U'🌍');
368 source:1:24: note: expression evaluates to ''\n' (0x0A, 10) == U'🌍' (0x1F30D, 127757)'
369 1 | static_assert("A\n"[1] == U'🌍');
371 - Clang now always diagnoses when using non-standard layout types in ``offsetof`` .
372 (`#64619: <https://github.com/llvm/llvm-project/issues/64619>`_)
373 - Clang now diagnoses redefined defaulted constructor when redefined
374 defaulted constructor with different exception specs.
375 (`#69094: <https://github.com/llvm/llvm-project/issues/69094>`_)
376 - Clang now diagnoses use of variable-length arrays in C++ by default (and
377 under ``-Wall`` in GNU++ mode). This is an extension supported by Clang and
378 GCC, but is very easy to accidentally use without realizing it's a
379 nonportable construct that has different semantics from a constant-sized
380 array. (`#62836 <https://github.com/llvm/llvm-project/issues/62836>`_)
382 - Clang changed the order in which it displays candidate functions on overloading failures.
383 Previously, Clang used definition of ordering from the C++ Standard. The order defined in
384 the Standard is partial and is not suited for sorting. Instead, Clang now uses a strict
385 order that still attempts to push more relevant functions to the top by comparing their
386 corresponding conversions. In some cases, this results in better order. E.g., for the
393 operator const char*();
396 void test() { Foo() - Foo(); }
398 Clang now produces a list with two most relevant builtin operators at the top,
399 i.e. ``operator-(int, int)`` and ``operator-(const char*, const char*)``.
400 Previously ``operator-(const char*, const char*)`` was the first element,
401 but ``operator-(int, int)`` was only the 13th element in the output.
402 However, new implementation does not take into account some aspects of
403 C++ semantics, e.g. which function template is more specialized. This
404 can sometimes lead to worse ordering.
407 - When describing a warning/error in a function-style type conversion Clang underlines only until
408 the end of the expression we convert from. Now Clang underlines until the closing parenthesis.
414 warning: cast from 'long (*)(const int &)' to 'decltype(fun_ptr)' (aka 'long (*)(int &)') converts to incompatible function type [-Wcast-function-type-strict]
415 24 | return decltype(fun_ptr)( f_ptr /*comment*/);
416 | ^~~~~~~~~~~~~~~~~~~~~~~~
422 warning: cast from 'long (*)(const int &)' to 'decltype(fun_ptr)' (aka 'long (*)(int &)') converts to incompatible function type [-Wcast-function-type-strict]
423 24 | return decltype(fun_ptr)( f_ptr /*comment*/);
424 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
426 - ``-Wzero-as-null-pointer-constant`` diagnostic is no longer emitted when using ``__null``
427 (or, more commonly, ``NULL`` when the platform defines it as ``__null``) to be more consistent
430 Improvements to Clang's time-trace
431 ----------------------------------
432 - Two time-trace scope variables are added. A time trace scope variable of
433 ``ParseDeclarationOrFunctionDefinition`` with the function's source location
434 is added to record the time spent parsing the function's declaration or
435 definition. Another time trace scope variable of ``ParseFunctionDefinition``
436 is also added to record the name of the defined function.
438 Bug Fixes in This Version
439 -------------------------
440 - Fixed an issue where a class template specialization whose declaration is
441 instantiated in one module and whose definition is instantiated in another
442 module may end up with members associated with the wrong declaration of the
443 class, which can result in miscompiles in some cases.
444 - Fix crash on use of a variadic overloaded operator.
445 (`#42535 <https://github.com/llvm/llvm-project/issues/42535>`_)
446 - Fix a hang on valid C code passing a function type as an argument to
447 ``typeof`` to form a function declaration.
448 (`#64713 <https://github.com/llvm/llvm-project/issues/64713>`_)
449 - Clang now reports missing-field-initializers warning for missing designated
451 (`#56628 <https://github.com/llvm/llvm-project/issues/56628>`_)
452 - Clang now respects ``-fwrapv`` and ``-ftrapv`` for ``__builtin_abs`` and
454 (`#45129 <https://github.com/llvm/llvm-project/issues/45129>`_,
455 `#45794 <https://github.com/llvm/llvm-project/issues/45794>`_)
456 - Fixed an issue where accesses to the local variables of a coroutine during
457 ``await_suspend`` could be misoptimized, including accesses to the awaiter
459 (`#56301 <https://github.com/llvm/llvm-project/issues/56301>`_)
460 The current solution may bring performance regressions if the awaiters have
461 non-static data members. See
462 `#64945 <https://github.com/llvm/llvm-project/issues/64945>`_ for details.
463 - Clang now prints unnamed members in diagnostic messages instead of giving an
465 (`#63759 <https://github.com/llvm/llvm-project/issues/63759>`_)
466 - Fix crash in __builtin_strncmp and related builtins when the size value
467 exceeded the maximum value representable by int64_t. Fixes
468 (`#64876 <https://github.com/llvm/llvm-project/issues/64876>`_)
469 - Fixed an assertion if a function has cleanups and fatal erors.
470 (`#48974 <https://github.com/llvm/llvm-project/issues/48974>`_)
471 - Clang now emits an error if it is not possible to deduce array size for a
472 variable with incomplete array type.
473 (`#37257 <https://github.com/llvm/llvm-project/issues/37257>`_)
474 - Clang's ``-Wunused-private-field`` no longer warns on fields whose type is
475 declared with ``[[maybe_unused]]``.
476 (`#61334 <https://github.com/llvm/llvm-project/issues/61334>`_)
477 - For function multi-versioning using the ``target``, ``target_clones``, or
478 ``target_version`` attributes, remove comdat for internal linkage functions.
479 (`#65114 <https://github.com/llvm/llvm-project/issues/65114>`_)
480 - Clang now reports ``-Wformat`` for bool value and char specifier confusion
482 (`#64987 <https://github.com/llvm/llvm-project/issues/64987>`_)
483 - Support MSVC predefined macro expressions in constant expressions and in
485 - Correctly parse non-ascii identifiers that appear immediately after a line splicing
486 (`#65156 <https://github.com/llvm/llvm-project/issues/65156>`_)
487 - Clang no longer considers the loss of ``__unaligned`` qualifier from objects as
488 an invalid conversion during method function overload resolution.
489 - Fix lack of comparison of declRefExpr in ASTStructuralEquivalence
490 (`#66047 <https://github.com/llvm/llvm-project/issues/66047>`_)
491 - Fix parser crash when dealing with ill-formed objective C++ header code. Fixes
492 (`#64836 <https://github.com/llvm/llvm-project/issues/64836>`_)
493 - Fix crash in implicit conversions from initialize list to arrays of unknown
494 bound for C++20. Fixes
495 (`#62945 <https://github.com/llvm/llvm-project/issues/62945>`_)
496 - Clang now allows an ``_Atomic`` qualified integer in a switch statement. Fixes
497 (`#65557 <https://github.com/llvm/llvm-project/issues/65557>`_)
498 - Fixes crash when trying to obtain the common sugared type of
499 `decltype(instantiation-dependent-expr)`.
500 Fixes (`#67603 <https://github.com/llvm/llvm-project/issues/67603>`_)
501 - Fixes a crash caused by a multidimensional array being captured by a lambda
502 (`#67722 <https://github.com/llvm/llvm-project/issues/67722>`_).
503 - Fixes a crash when instantiating a lambda with requires clause.
504 (`#64462 <https://github.com/llvm/llvm-project/issues/64462>`_)
505 - Fixes a regression where the ``UserDefinedLiteral`` was not properly preserved
506 while evaluating consteval functions. (`#63898 <https://github.com/llvm/llvm-project/issues/63898>`_).
507 - Fix a crash when evaluating value-dependent structured binding
508 variables at compile time.
509 Fixes (`#67690 <https://github.com/llvm/llvm-project/issues/67690>`_)
510 - Fixes a ``clang-17`` regression where ``LLVM_UNREACHABLE_OPTIMIZE=OFF``
511 cannot be used with ``Release`` mode builds. (`#68237 <https://github.com/llvm/llvm-project/issues/68237>`_).
512 - Fix crash in evaluating ``constexpr`` value for invalid template function.
513 Fixes (`#68542 <https://github.com/llvm/llvm-project/issues/68542>`_)
514 - Clang will correctly evaluate ``noexcept`` expression for template functions
515 of template classes. Fixes
516 (`#68543 <https://github.com/llvm/llvm-project/issues/68543>`_,
517 `#42496 <https://github.com/llvm/llvm-project/issues/42496>`_)
518 - Fixed an issue when a shift count larger than ``__INT64_MAX__``, in a right
519 shift operation, could result in missing warnings about
520 ``shift count >= width of type`` or internal compiler error.
521 - Fixed an issue with computing the common type for the LHS and RHS of a `?:`
522 operator in C. No longer issuing a confusing diagnostic along the lines of
523 "incompatible operand types ('foo' and 'foo')" with extensions such as matrix
524 types. Fixes (`#69008 <https://github.com/llvm/llvm-project/issues/69008>`_)
525 - Clang no longer permits using the `_BitInt` types as an underlying type for an
526 enumeration as specified in the C23 Standard.
527 Fixes (`#69619 <https://github.com/llvm/llvm-project/issues/69619>`_)
528 - Fixed an issue when a shift count specified by a small constant ``_BitInt()``,
529 in a left shift operation, could result in a faulty warnings about
530 ``shift count >= width of type``.
531 - Clang now accepts anonymous members initialized with designated initializers
533 Fixes (`#65143 <https://github.com/llvm/llvm-project/issues/65143>`_)
534 - Fix crash in formatting the real/imaginary part of a complex lvalue.
535 Fixes (`#69218 <https://github.com/llvm/llvm-project/issues/69218>`_)
536 - No longer use C++ ``thread_local`` semantics in C23 when using
537 ``thread_local`` instead of ``_Thread_local``.
538 Fixes (`#70068 <https://github.com/llvm/llvm-project/issues/70068>`_) and
539 (`#69167 <https://github.com/llvm/llvm-project/issues/69167>`_)
540 - Fix crash in evaluating invalid lambda expression which forget capture this.
541 Fixes (`#67687 <https://github.com/llvm/llvm-project/issues/67687>`_)
542 - Fix crash from constexpr evaluator evaluating uninitialized arrays as rvalue.
543 Fixes (`#67317 <https://github.com/llvm/llvm-project/issues/67317>`_)
545 Bug Fixes to Compiler Builtins
546 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
548 Bug Fixes to Attribute Support
549 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
551 Bug Fixes to C++ Support
552 ^^^^^^^^^^^^^^^^^^^^^^^^
554 - Clang limits the size of arrays it will try to evaluate at compile time
555 to avoid memory exhaustion.
556 This limit can be modified by `-fconstexpr-steps`.
557 (`#63562 <https://github.com/llvm/llvm-project/issues/63562>`_)
559 - Fix a crash caused by some named unicode escape sequences designating
560 a Unicode character whose name contains a ``-``.
561 (Fixes `#64161 <https://github.com/llvm/llvm-project/issues/64161>`_)
563 - Fix cases where we ignore ambiguous name lookup when looking up members.
564 (`#22413 <https://github.com/llvm/llvm-project/issues/22413>`_),
565 (`#29942 <https://github.com/llvm/llvm-project/issues/29942>`_),
566 (`#35574 <https://github.com/llvm/llvm-project/issues/35574>`_) and
567 (`#27224 <https://github.com/llvm/llvm-project/issues/27224>`_).
569 - Clang emits an error on substitution failure within lambda body inside a
570 requires-expression. This fixes:
571 (`#64138 <https://github.com/llvm/llvm-project/issues/64138>`_).
573 - Update ``FunctionDeclBitfields.NumFunctionDeclBits``. This fixes:
574 (`#64171 <https://github.com/llvm/llvm-project/issues/64171>`_).
576 - Expressions producing ``nullptr`` are correctly evaluated
577 by the constant interpreter when appearing as the operand
578 of a binary comparison.
579 (`#64923 <https://github.com/llvm/llvm-project/issues/64923>`_)
581 - Fix a crash when an immediate invocation is not a constant expression
582 and appear in an implicit cast.
583 (`#64949 <https://github.com/llvm/llvm-project/issues/64949>`_).
585 - Fix crash when parsing ill-formed lambda trailing return type. Fixes:
586 (`#64962 <https://github.com/llvm/llvm-project/issues/64962>`_) and
587 (`#28679 <https://github.com/llvm/llvm-project/issues/28679>`_).
589 - Fix a crash caused by substitution failure in expression requirements.
590 (`#64172 <https://github.com/llvm/llvm-project/issues/64172>`_) and
591 (`#64723 <https://github.com/llvm/llvm-project/issues/64723>`_).
593 - Fix crash when parsing the requires clause of some generic lambdas.
594 (`#64689 <https://github.com/llvm/llvm-project/issues/64689>`_)
596 - Fix crash when the trailing return type of a generic and dependent
597 lambda refers to an init-capture.
598 (`#65067 <https://github.com/llvm/llvm-project/issues/65067>`_ and
599 `#63675 <https://github.com/llvm/llvm-project/issues/63675>`_)
601 - Clang now properly handles out of line template specializations when there is
602 a non-template inner-class between the function and the class template.
603 (`#65810 <https://github.com/llvm/llvm-project/issues/65810>`_)
605 - Fix a crash when calling a non-constant immediate function
606 in the initializer of a static data member.
607 (`#65985 <https://github.com/llvm/llvm-project/issues/65985>_`).
608 - Clang now properly converts static lambda call operator to function
610 (`#62594 <https://github.com/llvm/llvm-project/issues/62594>`_)
612 - Fixed some cases where the source location for an instantiated specialization
613 of a function template or a member function of a class template was assigned
614 the location of a non-defining declaration rather than the location of the
615 definition the specialization was instantiated from.
616 (`#26057 <https://github.com/llvm/llvm-project/issues/26057>`_`)
618 - Fix a crash when a default member initializer of a base aggregate
619 makes an invalid call to an immediate function.
620 (`#66324 <https://github.com/llvm/llvm-project/issues/66324>`_)
622 - Fix crash for a lambda attribute with a statement expression
623 that contains a `return`.
624 (`#48527 <https://github.com/llvm/llvm-project/issues/48527>`_)
626 - Clang now no longer asserts when an UnresolvedLookupExpr is used as an
627 expression requirement. (`#66612 https://github.com/llvm/llvm-project/issues/66612`)
629 - Clang now disambiguates NTTP types when printing diagnostics where the
630 NTTP types are compared with the 'diff' method.
631 (`#66744 https://github.com/llvm/llvm-project/issues/66744`)
633 - Fix crash caused by a spaceship operator returning a comparision category by
635 (`#64162 <https://github.com/llvm/llvm-project/issues/64162>`_)
636 - Fix a crash when calling a consteval function in an expression used as
637 the size of an array.
638 (`#65520 <https://github.com/llvm/llvm-project/issues/65520>`_)
640 - Clang no longer tries to capture non-odr-used variables that appear
641 in the enclosing expression of a lambda expression with a noexcept specifier.
642 (`#67492 <https://github.com/llvm/llvm-project/issues/67492>`_)
644 - Fix crash when fold expression was used in the initialization of default
646 (`#67395 <https://github.com/llvm/llvm-project/issues/67395>`_)
648 - Fixed a bug causing destructors of constant-evaluated structured bindings
649 initialized by array elements to be called in the wrong evaluation context.
651 - Fix crash where ill-formed code was being treated as a deduction guide and
652 we now produce a diagnostic. Fixes:
653 (`#65522 <https://github.com/llvm/llvm-project/issues/65522>`_)
655 - Fixed a bug where clang incorrectly considered implicitly generated deduction
656 guides from a non-templated constructor and a templated constructor as ambiguous,
657 rather than prefer the non-templated constructor as specified in
660 - Fixed a crash caused by incorrect handling of dependence on variable templates
661 with non-type template parameters of reference type. Fixes:
662 (`#65153 <https://github.com/llvm/llvm-project/issues/65153>`_)
664 - Clang now properly compares constraints on an out of line class template
665 declaration definition. Fixes:
666 (`#61763 <https://github.com/llvm/llvm-project/issues/61763>`_)
668 - Fix a bug where implicit deduction guides are not correctly generated for nested template
670 (`#46200 <https://github.com/llvm/llvm-project/issues/46200>`_)
671 (`#57812 <https://github.com/llvm/llvm-project/issues/57812>`_)
673 - Diagnose use of a variable-length array in a coroutine. The design of
674 coroutines is such that it is not possible to support VLA use. Fixes:
675 (`#65858 <https://github.com/llvm/llvm-project/issues/65858>`_)
677 - Fix bug where we were overriding zero-initialization of class members when
678 default initializing a base class in a constant expression context. Fixes:
679 (`#69890 <https://github.com/llvm/llvm-project/issues/69890>`_)
681 - Fix crash when template class static member imported to other translation unit.
683 (`#68769 <https://github.com/llvm/llvm-project/issues/68769>`_)
685 - Clang now defers the instantiation of explicit specifier until constraint checking
686 completes (except deduction guides). Fixes:
687 (`#59827 <https://github.com/llvm/llvm-project/issues/59827>`_)
689 Bug Fixes to AST Handling
690 ^^^^^^^^^^^^^^^^^^^^^^^^^
691 - Fixed an import failure of recursive friend class template.
692 `Issue 64169 <https://github.com/llvm/llvm-project/issues/64169>`_
693 - Remove unnecessary RecordLayout computation when importing UnaryOperator. The
694 computed RecordLayout is incorrect if fields are not completely imported and
695 should not be cached.
696 `Issue 64170 <https://github.com/llvm/llvm-project/issues/64170>`_
697 - Fixed ``hasAnyBase`` not binding nodes in its submatcher.
698 (`#65421 <https://github.com/llvm/llvm-project/issues/65421>`_)
699 - Fixed a bug where RecursiveASTVisitor fails to visit the
700 initializer of a bitfield.
701 `Issue 64916 <https://github.com/llvm/llvm-project/issues/64916>`_
703 Miscellaneous Bug Fixes
704 ^^^^^^^^^^^^^^^^^^^^^^^
706 Miscellaneous Clang Crashes Fixed
707 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
708 - Fixed a crash when parsing top-level ObjC blocks that aren't properly
709 terminated. Clang should now also recover better when an @end is missing
711 `Issue 64065 <https://github.com/llvm/llvm-project/issues/64065>`_
712 - Fixed a crash when check array access on zero-length element.
713 `Issue 64564 <https://github.com/llvm/llvm-project/issues/64564>`_
714 - Fixed a crash when an ObjC ivar has an invalid type. See
715 (`#68001 <https://github.com/llvm/llvm-project/pull/68001>`_)
717 Target Specific Changes
718 -----------------------
722 - Use pass-by-reference (byref) in stead of pass-by-value (byval) for struct
723 arguments in C ABI. Callee is responsible for allocating stack memory and
724 copying the value of the struct if modified. Note that AMDGPU backend still
725 supports byval for struct arguments.
730 - Added option ``-m[no-]evex512`` to disable ZMM and 64-bit mask instructions
732 - Support ISA of ``USER_MSR``.
733 * Support intrinsic of ``_urdmsr``.
734 * Support intrinsic of ``_uwrmsr``.
735 - Support ISA of ``AVX10.1``.
736 - ``-march=pantherlake`` and ``-march=clearwaterforest`` are now supported.
738 Arm and AArch64 Support
739 ^^^^^^^^^^^^^^^^^^^^^^^
741 - C++ function name mangling has been changed to align with the specification
742 (https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst).
743 This affects C++ functions with SVE ACLE parameters. Clang will use the old
744 manglings if ``-fclang-abi-compat=17`` or lower is specified.
749 - Android target triples are usually suffixed with a version. Clang searches for
750 target-specific runtime and standard libraries in directories named after the
751 target (e.g. if you're building with ``--target=aarch64-none-linux-android21``,
752 Clang will look for ``lib/aarch64-none-linux-android21`` under its resource
753 directory to find runtime libraries). If an exact match isn't found, Clang
754 would previously fall back to a directory without any version (which would be
755 ``lib/aarch64-none-linux-android`` in our example). Clang will now look for
756 directories for lower versions and use the newest version it finds instead,
757 e.g. if you have ``lib/aarch64-none-linux-android21`` and
758 ``lib/aarch64-none-linux-android29``, ``-target aarch64-none-linux-android23``
759 will use the former and ``-target aarch64-none-linux-android30`` will use the
760 latter. Falling back to a versionless directory will now emit a warning, and
761 the fallback will be removed in Clang 19.
765 - Fixed an assertion failure that occurred due to a failure to propagate
766 ``MSInheritanceAttr`` attributes to class template instantiations created
767 for explicit template instantiation declarations.
769 - The ``-fno-auto-import`` option was added for MinGW targets. The option both
770 affects code generation (inhibiting generating indirection via ``.refptr``
771 stubs for potentially auto imported symbols, generating smaller and more
772 efficient code) and linking (making the linker error out on such cases).
773 If the option only is used during code generation but not when linking,
774 linking may succeed but the resulting executables may expose issues at
782 - Unaligned memory accesses can be toggled by ``-m[no-]unaligned-access`` or the
783 aliases ``-m[no-]strict-align``.
785 CUDA/HIP Language Changes
786 ^^^^^^^^^^^^^^^^^^^^^^^^^
794 - Introduced the ``-maix-small-local-exec-tls`` option to produce a faster
795 access sequence for local-exec TLS variables where the offset from the TLS
796 base is encoded as an immediate operand.
797 This access sequence is not used for TLS variables larger than 32KB, and is
798 currently only supported on 64-bit mode.
806 DWARF Support in Clang
807 ----------------------
809 Floating Point Support in Clang
810 -------------------------------
811 - Add ``__builtin_elementwise_log`` builtin for floating point types only.
812 - Add ``__builtin_elementwise_log10`` builtin for floating point types only.
813 - Add ``__builtin_elementwise_log2`` builtin for floating point types only.
814 - Add ``__builtin_elementwise_exp`` builtin for floating point types only.
815 - Add ``__builtin_elementwise_exp2`` builtin for floating point types only.
816 - Add ``__builtin_set_flt_rounds`` builtin for X86, x86_64, Arm and AArch64 only.
817 - Add ``__builtin_elementwise_pow`` builtin for floating point types only.
818 - Add ``__builtin_elementwise_bitreverse`` builtin for integer types only.
819 - Add ``__builtin_elementwise_sqrt`` builtin for floating point types only.
820 - ``__builtin_isfpclass`` builtin now supports vector types.
821 - ``#pragma float_control(precise,on)`` enables precise floating-point
822 semantics. If ``math-errno`` is disabled in the current TU, clang will
823 re-enable ``math-errno`` in the presense of
824 ``#pragma float_control(precise,on)``.
825 - Add ``__builtin_exp10``, ``__builtin_exp10f``,
826 ``__builtin_exp10f16``, ``__builtin_exp10l`` and
827 ``__builtin_exp10f128`` builtins.
828 - Add ``__builtin_iszero``, ``__builtin_issignaling`` and
829 ``__builtin_issubnormal``.
833 - Add ``convertVectorExpr``.
834 - Add ``dependentSizedExtVectorType``.
835 - Add ``macroQualifiedType``.
839 - Add ``AllowBreakBeforeNoexceptSpecifier`` option.
840 - Add ``AllowShortCompoundRequirementOnASingleLine`` option.
841 - Change ``BreakAfterAttributes`` from ``Never`` to ``Leave`` in LLVM style.
846 - Exposed arguments of ``clang::annotate``.
851 - Added a new checker ``core.BitwiseShift`` which reports situations where
852 bitwise shift operators produce undefined behavior (because some operand is
853 negative or too large).
854 - Move checker ``alpha.unix.StdCLibraryFunctions`` out of the ``alpha`` package
855 to ``unix.StdCLibraryFunctions``.
857 - Fix false positive in mutation check when using pointer to member function.
858 (`#66204: <https://github.com/llvm/llvm-project/issues/66204>`_).
860 - The ``alpha.security.taint.TaintPropagation`` checker no longer propagates
861 taint on ``strlen`` and ``strnlen`` calls, unless these are marked
862 explicitly propagators in the user-provided taint configuration file.
863 This removal empirically reduces the number of false positive reports.
864 Read the PR for the details.
865 (`#66086 <https://github.com/llvm/llvm-project/pull/66086>`_)
867 - A few crashes have been found and fixed using randomized testing related
868 to the use of ``_BitInt()`` in tidy checks and in clang analysis. See
869 `#67212 <https://github.com/llvm/llvm-project/pull/67212>`_,
870 `#66782 <https://github.com/llvm/llvm-project/pull/66782>`_,
871 `#65889 <https://github.com/llvm/llvm-project/pull/65889>`_,
872 `#65888 <https://github.com/llvm/llvm-project/pull/65888>`_, and
873 `#65887 <https://github.com/llvm/llvm-project/pull/65887>`_
875 .. _release-notes-sanitizers:
880 - ``-fsanitize=signed-integer-overflow`` now instruments ``__builtin_abs`` and
883 Python Binding Changes
884 ----------------------
886 Additional Information
887 ======================
889 A wide variety of additional information is available on the `Clang web
890 page <https://clang.llvm.org/>`_. The web page contains versions of the
891 API documentation which are up-to-date with the Git version of
892 the source code. You can access versions of these documents specific to
893 this release by going into the "``clang/docs/``" directory in the Clang
896 If you have any questions or comments about Clang, please feel free to
897 contact us on the `Discourse forums (Clang Frontend category)
898 <https://discourse.llvm.org/c/clang/6>`_.