Clang (In-Progress) Release Notes#
Written by the LLVM Team
Warning
These are in-progress notes for the upcoming Clang 24 release. Release notes for previous releases can be found on the Releases Page.
Introduction#
This document contains the release notes for the Clang C/C++/Objective-C frontend, part of the LLVM Compiler Infrastructure, release 24.0.0git. Here we describe the status of Clang in some detail, including major improvements from the previous release and new feature work. For the general LLVM release notes, see the LLVM documentation. For the libc++ release notes, see this page. All LLVM releases may be downloaded from the LLVM releases web site.
For more information about Clang or LLVM, including information about the latest release, please see the Clang Web Site or the LLVM Web Site.
Potentially Breaking Changes#
C/C++ Language Potentially Breaking Changes#
-Wunicode-whitespacenow defaults to an error. The previous behavior can be restored with-Wno-error=unicode-whitespace. Clang will stop accepting non-ascii whitespaces as token separators in a future version of Clang.
C++ Specific Potentially Breaking Changes#
The
[[carries_dependency]]attribute is no longer recognized, in any language mode, as it was removed from the standard by P3475R2.
Objective-C Specific Potentially Breaking Changes#
Fixed an issue where AST consumers based on
RecursiveASTVisitorwould bypass the exception parameter declaration inside Objective-C@catchblocks. This could cause tooling that previously ignored the parameter declaration to now find valid issues. (#212564)
ABI Changes in This Version#
Except on PlayStation, Clang now derives the x86-64 System V AVX ABI level for 256- and 512-bit vector arguments and returns from effective per-function target features. Features and
arch=CPUs that imply AVX or AVX512F are honored, and calls use the caller’s features, matching GCC. Per-function features cannot lower the translation-unit ABI level;-fclang-abi-compat=23restores the previous behavior. (#193298)On SPARC, a
_Complexvalue with an integer element type is now passed and returned packed into the one or two integer registers it fits in, matching GCC. Clang previously passed such a value indirectly and returned it with one part per register.-fclang-abi-compat=23restores the previous behavior. (#212340)On SPARC64, a
_Complex charor_Complex shortis now right-justified in its slot in the parameter array, like every other scalar narrower than a slot, rather than left-justified the way a small struct is.-fclang-abi-compat=23restores the previous behavior. (#212340)On MIPS, a
_Complexvalue with an integer element type is now returned packed into a single integer register when it fits in one, matching GCC. A_Complex charor_Complex short, and on N32/N64 also a_Complex int, is no longer returned with one part per register.-fclang-abi-compat=23restores the previous behavior. (#212109)On MIPS N32/N64, a
_Complex floator_Complex doubleargument is now packed into integer registers, or onto the stack, once there is no longer room to give each of its parts a floating-point register, matching GCC. Clang previously always passed the parts separately.-fclang-abi-compat=23restores the previous behavior. (#212109)On MIPS N32/N64, an
__int128now correctly start in an even-numbered register or 16-byte aligned stack slot, matching GCC.Except on PlayStation, on x86-64 System V a non-zero-width unnamed bit-field now classifies the eightbytes it occupies as INTEGER, like a named bit-field, matching GCC. Aggregates where this changes the classification may be passed or returned differently – a struct holding a run of
__int128bit-fields, for example, now travels in the two integer registers the ABI assigns it. This also fixes a crash when such a struct was passed or returned.-fclang-abi-compat=23restores the previous behavior. (#202205)Clang now considers matrix types in its isHomogeneousAggregate() handling, which can lead to differences in how structures containing matrix types are classified for ABI purposes. The previous exclusion of matrix types appears to have been accidental. Matrix types now follow the same rules as arrays for homogeneous aggregate classification.
-fclang-abi-compat=23restores the previous behavior. (#218799)
AST Dumping Potentially Breaking Changes#
Clang Frontend Potentially Breaking Changes#
Templight support has been removed.
-fstack-clash-protectionhas been enabled implicitly by default for android target triples (except 32b arm targets). Can be disabled via-fno-stack-clash-protection.
Clang Python Bindings Potentially Breaking Changes#
CompletionChunkKindinstance’s__str__representation has been adapted to be consistent with other enums in the library. The representation now follows theCompletionChunkKind.VARIANT_NAMEscheme instead ofVariantName.Remove the deprecated
SPELLING_CACHEalias. All usage should be migrated to useCompletionChunk.SPELLING_CACHEinstead. Note that this usesCompletionChunkKindenumeration as keys, instead of integer values.Remove the deprecated
CompletionChunk.isKind...methods. Existing uses should be adapted to directly compare equality of theCompletionChunkkind with the correspondingCompletionChunkKindvariant.Affected methods:
isKindOptional,isKindTypedText,isKindPlaceHolder,isKindInformativeandisKindResultType.CompletionString.availabilitynow returns instances ofAvailabilityKind. As a result, the__str__representation of its return values changed. Like other libclang enums, it now follows theCompletionChunkKind.VARIANT_NAMEscheme instead ofVariantName.Cursorinstance’senum_valuemethod now returns 1 instead of -1 fortruebool enumeration values
OpenCL Potentially Breaking Changes#
What’s New in Clang 24.0.0git?#
C++ Language Changes#
Clang now supports friend declarations with a dependent nested name specifier. (#104057)
auto()casts are accepted as an extension pre-C++23.
C++2d Feature Support#
Clang now supports P3658R1 (Adjust identifier following new Unicode recommendations), applied as a DR to all C++ language modes.
Clang now supports P3670R4 (Pack indexing for template names), which allows a pack of templates to be indexed, as in
TT...[0]<int>. Like pack indexing of types and expressions, this is available in all C++ language modes as an extension, controlled by-Wc++2d-extensionsand-Wpre-c++2d-compat, and__cpp_pack_indexingis bumped to202606L.
C++2c Feature Support#
Added
__builtin_type_orderfor compatibility with GCC as part of the implementation of P2830R10 (Constexpr Type Ordering).Clang now supports P3533R2 (constexpr virtual inheritance).
Implemented the language part of P3475R2 (Defang and deprecate
memory_order::consume) by removing support for the[[carries_dependency]]attribute.
C++23 Feature Support#
C++20 Feature Support#
Now clang-scan-deps in P1689 format can find the dependencies described in module map file. See the documents of standard C++ modules for details.
C++17 Feature Support#
Resolutions to C++ Defect Reports#
C Language Changes#
C2y Feature Support#
Clang now supports C2y’s new syntax for
ifandswitchstatements with initializer and condition variables, as specified in N3356_. For example:
if (bool x = true; x) {
// ...
}
if (bool x = true) {
// ...
}
// attribute list on declarations are also supported
switch ([[maybe_unused]] int x = 1) {
default:
// ...
}
if (bool x [[maybe_unused]] = true; x) {
// ...
}
C23 Feature Support#
Objective-C Language Changes#
Non-comprehensive list of changes in this release#
Clang tools now resolve tool names without a path in compilation databases through
PATH.On musl targets, the driver now links
libssp_nonshared.awhen stack protection is enabled and the library is present in the toolchain library paths, matching what musl distributions configure GCC to do.Clang now allows GNU computed
gotoextension inconstexprfunctions, matching the relaxedconstexprfunction body rules introduced in C++23.Added support for the
__builtin_strlcatand__builtin_strlcpybuiltins.
New Compiler Flags#
New option
-fdefined-pointer-subtractionadded to preserve stable semantics when subtracting pointers to unrelated objects.Added
--print-cxx-stdliband--print-cxx-stdlib-include-dirsto print the C++ standard library selected by the driver and the include directories added for it.Added
-mscs-reg=<reg>on Hexagon to select which callee-saved register (r16-r27, defaultr18) holds the shadow call stack pointer under-fsanitize=shadow-call-stack. The selected register must also be reserved with the matching-ffixed-<reg>.Added
-fmodules-ignore-search-path=<path>, the search-path counterpart to-fmodules-ignore-macro=<macro>: the path is dropped from the context hash of every module and physically removed from every module build, and kept only for the translation unit itself. This lets builds that differ only in a search path share one module cache, and is only sound when no module needs the path – a lookup that would have resolved through an ignored path simply fails.
Deprecated Compiler Flags#
Modified Compiler Flags#
All options of the
-fzero-call-used-regscompiler flag are now allowed on RISC-V.
Removed Compiler Flags#
Attribute Changes in Clang#
Clang now properly propagates attributes on class and variable templates to their redeclarations, which will result in redeclarations not interfering with diagnostics. (#209812)
Clang now recognizes the
[[gnu::flag_enum]]attribute and treats it equivalent to[[clang::flag_enum]]
Improvements to Clang’s diagnostics#
-Wfortify-sourcenow diagnoses whenstrlcat,__builtin_strlcat,strlcpy, or__builtin_strlcpyis called with a size argument larger than the destination buffer.The
cannot overload a member functiondiagnostic now describes the previous declaration first, matching the order in which the declarations appear in the source. (#219803)More consistent rendering of Unicode characters in diagnostic messages.
Fixed
-Wunused-parameterto diagnose coroutine parameters that are only considered during allocation function lookup or promise object initialization, while not diagnosing parameters passed to the selected allocation function or promise constructor. (#217501)The
wbanduwb_BitIntliteral suffixes are no longer diagnosed by default before C23. They stay in-Wc23-extensionsand are still reported under-pedanticor when that group is enabled explicitly, matching how the_BitInttype itself is already handled.Fixed bug in
-Wdocumentationso that it correctly handles explicit function template instantiations (#64087).When a
constexprrange-based for loop variable cannot be initialized by a constant expression, Clang now emits a single note identifying the read of the loop’s implicit__beginvariable, instead of a generic note about reading a non-constexpr variable followed by adeclared herenote. (#211926)Fixed concept template parameters not being recognized in
-Wdocumentationwhen mentioned in tparam comments. (#64087)-Wunused-but-set-variablenow diagnoses file-scope variables with internal linkage (staticstorage class) that are assigned but never used. This new coverage is added under the subgroup-Wunused-but-set-global, allowing it to be disabled independently with-Wno-unused-but-set-global. (#148361)Added
-Wlifetime-safetyto enable lifetime safety analysis, a CFG-based intra-procedural analysis that detects use-after-free and related temporal safety bugs. See the RFC for more details. By design, this warning is enabled in-Weverything. To disable the analysis, use-Wno-lifetime-safetyor-fno-lifetime-safety.Added
-Wlifetime-safety-suggestionsto enable lifetime annotation suggestions. This provides suggestions for function parameters that should be marked[[clang::lifetimebound]]based on lifetime analysis. For example, for the following function:int* p(int *in) { return in; }
Clang will suggest:
warning: parameter in intra-TU function should be marked [[clang::lifetimebound]] int* p(int *in) { return in; } ^~~~~~~ [[clang::lifetimebound]] note: param returned here int* p(int *in) { return in; } ^~
Added
-Wlifetime-safety-noescapeto detect misuse of[[clang::noescape]]annotation where the parameter escapes through return. For example:int* p(int *in [[clang::noescape]]) { return in; }
Clang will warn:
warning: parameter is marked [[clang::noescape]] but escapes int* p(int *in [[clang::noescape]]) { return in; } ^~~~~~~ note: returned here int* p(int *in [[clang::noescape]]) { return in; } ^~
Added
-Wlifetime-safety-dangling-fieldto detect dangling field references when stack memory escapes to class fields. This is part of-Wlifetime-safetyand detects cases where local variables or parameters are stored in fields but outlive their scope. For example:struct DanglingView { std::string_view view; DanglingView(std::string s) : view(s) {} // warning: address of stack memory escapes to a field };
Improved
-Wassign-enumperformance by caching enum enumerator values. (#176454)Fixed a false negative in
-Warray-boundswhere the warning was suppressed when accessing a member function on a past-the-end array element. (#179128)Added a missing space to the FixIt for the
implicit-intgroup of diagnostics and made sure that only one such diagnostic and FixIt is emitted per declaration group. (#179354)Fixed the Fix-It insertion point for
expected ';' after alias declarationwhen parsing alias declarations involving a token-split>>sequence (for example,using A = X<int>>;). (#184425)Fixed incorrect
implicitly deleteddiagnostic for explicitly deleted candidate function. (#185693)The
-Wloop-analysiswarning has been extended to catch more cases of variable modification inside lambda expressions (#132038).Clang now emits
-Wsizeof-pointer-memaccesswhen snprintf/vsnprintf use the sizeof the destination buffer(dynamically allocated) in the len parameter(#162366)Added
-Wmodule-map-path-outside-directory(off by default) to warn on header and umbrella directory paths that use..to refer outside the module directory in module maps found via implicit search (-fimplicit-module-maps). This does not affect module maps specified explicitly via-fmodule-map-file=.Honour
[[maybe_unused]]attribute on private fields.-Wunused-private-fieldno longer emits a warning for annotated private fields.Improved
-Wgnu-zero-variadic-macro-argumentsto suggest using__VA_OPT__if the current language version supports it(#188624)Clang now emits an error when implicitly casting a complex type to a built-in vector type. (#186805)
Added
-Wnonportable-include-path-separator(off by default) to catch #include directives that use backslashes as a path separator. The warning includes a FixIt to change all the backslashes to forward slashes, so that the code can automatically be made portable to other host platforms that don’t support backslashes.Clang now explains why template deduction fails for explicit template arguments.
No longer emitting a
-Wpre-c2y-compator extension diagnostic about use of octal literals with a0oprefix, and no longer emitting a-Wdeprecated-octal-literalsdiagnostic for use of octal literals without a0oprefix, when the literal is expanded from a macro defined in a system header. (#192389)Improved error recovery for missing semicolons after class members. Clang now avoids skipping subsequent valid declarations when their previous decl is missing semicolon.
Removed the body of lambdas from some diagnostic messages.
Fixed false positive host-device mismatch errors in discarded
if constexprbranches for CUDA/HIP; such calls are now correctly skipped.Clang now errors when a function declaration aliases a variable or vice versa. (#195550)
Added
-Wattribute-aliasto diagnose type mismatches between an alias and its aliased function. (#195550)The diagnostics around
__blocknow explain why a variable cannot be marked__block. (#197213)Extended
-Wnonportable-include-pathto warn about trailing whitespace and dots in#includepaths. (#190610)Clang now emits error when attribute is missing closing
]]followed by;;. (#187223)Clang now rejects inline asm constraints and clobbers that contain an embedded null character, instead of silently truncating them. (#173900)
Added
-Wstringop-overreadto warn whenmemcpy,memmove,memcmp, and related builtins read more bytes than the source buffer size (#83728).Diagnostics for the C++11 range-based for statement now report the correct iterator type in notes for invalid iterator types.
-Wfortify-sourcenow warns when the constant-evaluated argument toumaskhas bits set outside0777. Those bits are silently discarded by the kernel, so setting them is almost always a typo (matching the bionic libcdiagnose_ifcheck).Improved how Unicode characters are displayed in diagnostic messages.
-Wtautological-pointer-compareand-Wpointer-bool-conversionnow diagnose a reference to a function (e.g. of typevoid (&)()) compared against or converted to a null pointer, the same as a bare function name. (#46362)Clang now attempts to print enumerator names rather than C-style cast expressions in more diagnostics.
-Wunsafe-buffer-usagenow warns about unsafe two-parameter constructors ofstd::string_view(pointer and size), consistent with the existing warning forstd::span.-Wno-unsafe-buffer-usage-in-static-sized-arraynow also suppresses warnings for pointer arithmetic on statically-sized arrays when the offset is a non-negative constant within the array bounds.-Wc++98-compatnow diagnoses explicit conversion functions in C++20 and later, matching the behavior in C++11 through C++17. (#161689)Added
-Wcounter-extensionas a diagnostic group under-Wc2y-extensionsto control__COUNTER__being diagnosed as an extension. This allows-pedanticusers to disable the diagnostic with-Wno-counter-extensionwithout having to disable all pedantic diagnostics. (#196557)Clang now diagnoses more details when a constraint evaluates to false.
-Wpointer-arithno longer reports subtraction of pointers to a variably modified type, such asint[n], as a subtraction of pointers to a type of zero size, unless the size is provably zero: a zero-sized base element or a dimension that is a zero integer constant, as instruct Empty vla[n]orint vla[n][0]. (#28328)Fixed a missing
-Wconstant-conversiondiagnostic for signedchararrays.Clang now diagnoses passing wrong vector type as a mask to
__builtin_shufflevector. (#218132)-Wdelete-abstract-non-virtual-dtorand-Wdelete-non-abstract-non-virtual-dtorno longer warn when the selected deallocation function is a destroyingoperator delete, since such a delete expression never invokes the destructor. (#65524)Fixed a false-positive
-Wshadowwarning when a variable in an inline-defined friend function shares the name of a non-static class member variable. (#221190)Clang now diagnoses matrix logical operations are only supported for HLSL. (GH222381)
Improve the input size mismatch diagnostic when calling
__builtin_shufflevectorwith valid vector element types but different sizes. (GH221791)Suggests the correct location for an attribute written before the
usingkeyword of an alias-declaration. (#155787)Improve Clang diagnoses when unary
__imagoperator with non-complex type operand is used as lvalue. (GH222383)
Improvements to Clang’s time-trace#
Improvements to Coverage Mapping#
Bug Fixes in This Version#
Fixed incorrect handling of C++ import preprocessing token when a digraph character after import. (#190693)
Fixed an assertion failure when passing a wide string literal to
__builtin_nan. (#212108)Fixed a constraint comparison bug in partial ordering. (#182671)
Fixed a rejected-valid case that used an explicit object parameter in an out-of-line definition of a nested class member. (#136472)
Fixed an assertion on omp taskloop transparent (#197162)
Fixed a bug where
__func__,__PRETTY_FUNCTION__and__FUNCTION__were not resolving to the proper function when inside a lambda return type (#211811)Fixed USR generation for declarations whose signature mentions a class-type non-type template parameter. (#212351)
Fixed an assertion caused by Microsoft integer literals exceeding the maximum value. (#212504)
Fixed an assertion failure when a value of a Unicode character type (
char8_t,char16_t,char32_t) was implicitly splatted to a vector of the same element type, e.g. when comparing anext_vector_typeofchar32_twith one of its elements. (#202317)Fixed a crash when checking scalar type with excess braces. (#69213), (#137845), (#198767), (#207566), (#106180)
Fixed an assertion crash when instantiating a nested requirement with an invalid constraint. (#213575)
Clang now defines the GCC-compatible predefined macro
__SIG_ATOMIC_TYPE__. (#213895)Fixed IEEE f128 complex mul/div using the IBM f128 libcalls on powerpc. (#216820)
Fixed an ICE that occurred when a structured binding pack is expanded outside the lambda where it was declared. (#214160)
Fixed a bug where a stray closing curley brace in an OpenMP/OpenACC pragma could cause pragma parsing issues when inside of a member function. (#214195)
Fixed a bug where preprocessor directives following comments were not correctly recognized when using -C. (#48361)
Fixed a crash when declaring a member template within a local class inside an OpenMP region. (#216052)
Fixed a bug where repeated #imports of modular headers in non-modular compilation were translated to #pragma clang module import. (#216924)
Fixed an assertion when
#pragma omp declare simdor#pragma omp declare variantis followed by another OpenMP declarative directive containing a qualified identifier. (#217204)Fixed a crash when an
asmlabel names the register for a global variable of incomplete type. (#219746)Fixed an ICE hat occurred when using
__imag int/floatas lvalue in assignment. (#119498)Fixed an assertion failure in
-Wsign-comparewhen a negated or complemented vector of unsigned integers was compared against a signed constant. (#203575)
Bug Fixes to Compiler Builtins#
Fixed a crash when classifying a call to a builtin with dependent arguments, such as when the call is used as an
autonon-type template argument.Fixed an assertion failure when diagnosing a constant evaluation failure inside a member function call synthesized by
__builtin_invoke. (#185241)Fixed a crash in
__builtin_dump_structwhen-Werrorpromotes format warnings to errors. (#211943)Fixed a wrong code generation in
__builtin_clear_paddingwherein the wrong bits of the_BitInttype were cleared in big-endian mode.Fixed an assertion failure when
__builtin_vectorelementsis applied to a reference to a vector type;vec_step(in C++ for OpenCL) and__builtin_ptrauth_type_discriminatorsimilarly no longer accept reference types that their evaluation silently mishandled. (#216997)
Bug Fixes to Attribute Support#
Fixed crash (assertion) when the
alloc_alignattribute was applied to a declaration whose type has aFunctionProtoTypebut which is not itself aFunctionDecl, such as a function-pointer variable. (#122058)The
counted_by/counted_by_or_nulldiagnostic that rejects a pointer whose pointee is a struct with a flexible array member (e.g.struct with_fam * __sized_by(size) ptr;) was incorrectly also applied to thesized_by/sized_by_or_nullattributes. Becausesized_byandsized_by_or_nulldescribe the size in bytes rather than a count of elements, they are now correctly accepted on such pointers.Fixed a crash when an
address_spaceattribute with a dependent argument was written after the declarator-id, where it appertains to the declared entity rather than to a declarator chunk. (#196982, #111463)
Bug Fixes to C++ Support#
Fixed the destruction timing of temporaries created by default member initializers during aggregate initialization. Such an initializer is part of the full-expression containing the aggregate initialization. (#85601)
Fixed false-positive module ODR diagnostics when a type is found through a using-declaration in one definition and directly in another. ODR hashing also now distinguishes differently qualified uses of types found through using-declarations. (#78850)
Fixed an assertion when diagnosing module ODR violations for enum underlying types found through using-declarations with the same name but different types.
Fixed a false type mismatch when a typedef naming an anonymous enumeration was used through a C++20 named module and its defining header was subsequently included. (#213299)
Fixed an issue where
__typeof__incorrectly rejected cv-qualified function types.Fixed an assertion failure when
#embedwas used in the braced initializer of an array new-expression, or of an array whose elements are of class type. (#128985)Fixed a bug where top-level CV qualifiers (such as
const) were dropped from pointers modified by Microsoft pointer attributes (like__ptr32and__ptr64) and WebAssembly’s__funcref.Fixed a bug where we accepted
__superbeing qualified by a scope specifier, causing codegen to assertion fail elsewhere. (#212988)Fixed an issue where we tried to compare invalid NTTPs for variable declarations, which ended up in hitting an assertion with a constrained non-plain-auto NTTP, which we don’t quite implement yet. (#208658)
Fixed a crash when a using-declaration naming an unresolvable member of a dependent base was shadowed by an invalid using-declaration. (#209427)
Fixed a CTAD bug when combining with concepts. (#124715)
Fixed a regression where an internal-linkage function (e.g. a
staticor anonymous-namespace helper) declared in the global module fragment of the current translation unit was removed from the overload set when the calling template was instantiated after the global module fragment was closed, producing a spurious “no matching function” error with no candidate notes. (#210822)Fixed a crash when module directive export module foo not following a semicolon and there are no rest pp-tokens in current module file. (#187771)
Fixed concept evaluation bugs where some declarations were not added to the current instantiation scope. (#198052)
Fixed a crash when a lambda parameter pack was given a default argument that is a pack expansion referencing an enclosing function’s parameter pack (e.g.
[](Types... = args...) {}). Clang now diagnoses the illegal default argument instead of asserting. (#210714)Fixed a crash on invalid code where a
decltypenot followed by(was parsed where a nested-name-specifier could appear (e.g.int decltype = 0;). Clang now diagnoses the error instead of asserting. (#211207)Fixed an assertion failure when a parenthesized structured binding declarator was followed by a function declarator and body (e.g.
([a, b])() {}). (#218144, #193687)Fixed a crash when computing the implicit deletion of a defaulted comparison operator required an access check that ran while an enclosing declaration was still being parsed. (#210692)
Fixed an assertion when a call to a class object was resolved through a conversion function to a function pointer that was introduced into the class by a using-declaration (e.g.
using Base::operator auto;). Such a conversion function is now also diagnosed if it is deleted. (#189146)A workaround that was introduced to fix an issue with the
<format>header present in some versions of libstdc++15 has been extended to support preprocessed input. Previously, splitting the preprocessing and compilation step would result in the fix not being applied. (#160314)A defaulted copy or move assignment operator for a union was left with an empty body and copied nothing when the operator was actually called, for example through a pointer to member. Clang now synthesizes a whole-object copy so the union’s object representation is copied, matching the defaulted union copy constructor.
Compute value dependence correctly for structured bindings. This mostly affect C++26 constexpr structured bindings and expansion statements, but also affects some uses of plain structured bindings. (#211930)
Fixed an assertion when instantiating the body of a C++26 expansion statement after a fatal error had occurred. (#214917)
Fixed an assertion when an invalid statement appeared in a
switchstatement nested inside a C++26 expansion statement. (#210575)Fixed friend declarations sometimes making non-visible default arguments incorrectly visible to default argument redefinition checks across modules.
Fixed handling of SFINAE failures for expressions which depend on in-class member initializers of templates which are not yet parsed. An example is using
__is_constructibleon a nested class template inside the definition of the containing class. (#215166)Fixed a bug where Clang incorrectly required
promise.return_value()for a dependentco_returnoperand that inits tovoid, instead of usingpromise.return_void(). (#218368)Fixed merging of lambdas across modules in the case where neither lambda is imported from an AST file. (#214560)
Fixed a crash when a non-type template parameter of reference type is bound to a subobject and is used in a context that requires an implicit conversion. (#215900)
Fixed an assertion when mangling an abbreviated function template whose return type has an ABI tag. (#204178)
Fixed an assertion during template argument deduction where a function parameter pack is referenced by other types in the function type. (#28877), (#213760)
Fixed a regression where deprecation warnings were omitted for synthesized deduction guide. (#160543)
Fixed an assertion when a redeclaration of a function template or an out-of-line definition of a member of a class template added a default argument to a parameter that follows a parameter pack (e.g.
template <typename... T> S::S(T..., int = 10) {}). (#216211)Fixed an assertion failure when instantiating a late-parsed function template defined in an earlier translation unit with -fdelayed-template-parsing. (#217073)
Allow redeclaration lookup to consider conversion function templates, allowing Clang to match an in-class specialization such as
template<> operator int()against a prior conversion function templatetemplate<class T> operator T(). (#218261)Fixed an assertion when an ill-formed qualified member function definition inside a union caused the union to be treated as a polymorphic class. (#213854)
Fixed an assertion when a type-trait keyword that had already been made available as an identifier (e.g.
struct __make_unsigned) was seen again in a token that was lexed and cached before the first occurrence was parsed. (#214128)Fixed a crash when a coroutine keyword appeared inside a mem-initializer on a function that is not a constructor. (#194298)
Fixed an assertion when a defaulted comparison operator was synthesized for a class with an invalid non-static data member, such as one qualified with an address space. (#194605)
Fixed deduction of the template parameters appearing in the type of a constant template parameter of reference type. (#40328)
Fixed an issue where an explicit specialization of a constexpr variable would result in a link error. (#219796)
Bug Fixes to AST Handling#
Fixed a non-deterministic ordering of unused local typedefs that made serialized PCH/AST files and
-Wunused-local-typedefdiagnostics non-reproducible across runs. (#209639)FunctionDecl::getReturnTypeSourceRange()now returns correct source location of a trailing return type. (#162649)Added missed information to the AST node representing the member function when calling a explicit object member function. (#218829)
Miscellaneous Bug Fixes#
Miscellaneous Clang Crashes Fixed#
Fixed a crash in CTAD for type alias templates when the aggregate deduction guide could not be resolved. (#206994)
Fixed a crash when instantiating an invalid dependent friend destructor declaration in a class template. (#210234)
Fixed an assertion failure in
-extract-apiwhen a documentation comment contains invalid UTF-8. (#212393)Fixed a crash in codegen on 32-bit targets caused by a struct too large to represent in
size_t. Theerr_struct_too_largecheck now scales the threshold to the target’ssize_twidth instead of using a fixed threshold of1 << 60regardless of the target.Fixed a crash when generating fake uses for parameters of bodyless destructors with
-fextend-variable-liveness.Fixed a crash when filling in the
TypeLocfor anAttributedTypethat was inherited from a different declarator, for example when__typeof__resolves to the type of another, already-processed declaration. (#217489)Fixed an assertion failure when instantiating a block that captures
thisvia a member access through a dependent base class.Fixed
DiagnoseUnguardedAvailability::TraverseIfStmtdereferencing a nullptr onif consteval {}. (#220004)Fixed an assertion when the
dimargument to an OpenACCgangclause evaluated to a value not representable by a signed integer, such as an unsigned wrap around. (#221418)Fixed an assertion failure when a method or function definition follows an Objective-C
@implementationthat was ended by a nested@interface,@protocolor@implementationbefore its@end. (#209503)
OpenACC Specific Changes#
OpenCL Specific Changes#
Extensions
cl_khr_extended_bit_ops,cl_khr_integer_dot_product,cl_khr_subgroup_extended_types,cl_khr_subgroup_rotate,cl_khr_subgroup_shuffle, andcl_khr_subgroup_shuffle_relativeare promoted to core features in OpenCL C 3.1. A target claiming OpenCL C 3.1 conformance without supporting one of these features is now diagnosed.
Target Specific Changes#
AMDGPU Support#
Deprecated the following builtins in favor of
__builtin_amdgcn_ballot_w32or__builtin_amdgcn_ballot_w64:__builtin_amdgcn_uicmp__builtin_amdgcn_uicmpl__builtin_amdgcn_sicmpl__builtin_amdgcn_fcmp__builtin_amdgcn_fcmpf
DirectX Support#
clang-dxcand HLSL support are now enabled by default, following the promotion of the DirectX backend to an official LLVM target.
NVPTX Support#
X86 Support#
Arm and AArch64 Support#
Added support for pointer authentication discrimination of C++ virtual table pointers stored in VTTs via the
-fptrauth-vtt-vtable-pointer-discriminationoption.
Android Support#
Enabled PAC and BTI by default for AArch64 Android targets.
Windows Support#
Clang now accepts
_exceptas an alias for__exceptin SEH handler position when-fms-compatibilityis enabled, matching the existing_try,_finally, and_leavealiases._exceptremains an ordinary identifier outside that context.Fixed
setjmpon 32-bit Arm passing the frame pointer, rather than the stack pointer as it was on entry to the function, as the frame value the CRT stores in thejmp_buf. Clang now usesllvm.sponentrythere, as it already did on AArch64.Fixed a bug where Clang did not match the MSVC ABI on Arm64 when an over-aligned base class is followed by another base class. MSVC on Arm64 (but not Arm64EC or x64) reuses the tail padding of the over-aligned base for the subsequent base; Clang now does the same. (#210174)
LoongArch Support#
RISC-V Support#
Fixed a bug where the
interruptattribute did not acceptmachinetogether with bothSiFive-CLIC-preemptibleandSiFive-CLIC-stack-swap.Added a new warning when the same interrupt type is specified more than once in a RISC-V
interruptattribute.SiFive CLIC preemptible interrupt handlers now diagnose unsupported frame pointers instead of producing a backend fatal error.
Added
-march=nativefor better compatibility with ARM, AArch64, and X86. This option will be treated like-mcpu=nativeif-mcpuis not present. If-mcpuis present, the ISA will be selected from the host CPU and the tune CPU will be selected from-mcpu.
CUDA/HIP Language Changes#
HIP compilations now add the
include/libhipcxxdirectory from the selected ROCm installation to the header search path when it exists. This allows libhipcxx headers to be included with paths such as<cuda/std/atomic>. The-nogpuincoption disables this path together with the other HIP include paths.
CUDA Support#
Added
--cuda-emit-nvcc-abito emit the NVCC-compatible host registration ABI (__cudaRegisterLinkedBinary).Clang now provides device-side definitions of
__cxa_pure_virtual()and__cxa_deleted_virtual(); previously, any (potential) call to a pure/deleted virtual function that could not be optimised out would cause the program to fail to assemble. This is now fixed. (#49183) (#67533)
AIX Support#
NetBSD Support#
WebAssembly Support#
Added
__builtin_wasm_memory_copyand__builtin_wasm_memory_fillbuiltins for the WebAssemblymemory.copyandmemory.fillbulk memory instructions.
AVR Support#
SystemZ Support#
DWARF Support in Clang#
Floating Point Support in Clang#
Fixed Point Support in Clang#
AST Matchers#
clang-format#
Add
SpacesInBlockCommentsoption to control spacing after/*and before*/in ordinary block comments.Add
AfterRequiresExpressionsub-option ofBraceWrappingto wrap the body of requires expressions. It is enabled by theAllman,Whitesmiths, andGNUstyles ofBreakBeforeBraces.QualifierOrdernow supportstypedef,consteval,constinit,thread_local,extern,mutable,signed,unsigned,long,short, andexplicitdeclaration specifiers.
libclang#
visit identifier initializers in lambda capture as VarDecl instead of VariableRef. Warning: this changes behaviour.
Code Completion#
Parameters declared with a
decltypeare now presented as the type thedecltyperesolves to, e.g.set_x(int val)rather thanset_x(decltype(x) val). This affects the completion strings produced by libclang as well as those used by clangd.Members inherited from a dependent base class that is named through an alias template are suggested by code completion when relevant.
Static Analyzer#
Crash and bug fixes#
Improvements#
The lock-order-reversal check in
alpha.unix.PthreadLockis now disabled by default. It can be re-enabled with theWarnOnLockOrderReversaloption.
Moved checkers#
The alpha.cplusplus.UseAfterLifetimeEnd checker was renamed to alpha.core.UseAfterLifetimeEnd.
Diagnostic changes#
For self-assignments during initialization (
T v = v;),core.uninitialized.Assignwill not report them as uninitialized accesses (except C++ reference types), and the checks will be delayed until the first accesses of these variables;deadcode.DeadStoreswill not report them as dead stores. (#187530)
Sanitizers#
Python Binding Changes#
OpenMP Support#
Canonicalize intra-tiles in loop tiling.
#pragma omp tilestill emits a min-bounded inner loop, which vectorizes well. When a parent directive such asfor collapse(n)needs a constant per-tile trip count, Clang rereads a droppable hint and treats that inner loop as rectangular, with an overshoot guard only if the last tile can be partial.Not yet supported (diagnosed, left as follow-up):
collapsethrough stacked#pragma omp tile(the inner floor is not a collapsed counter).A loop transformation (
tile,unroll,interchange, …) that consumes another tile’s intra-tile loop.
Added parsing and semantic support for
dimsmodifier innum_teamsandthread_limitclauses for OpenMP 6.1 or later.Added parsing and semantic support for
dimsmodifier innum_teams,thread_limitandnum_threadsclauses for OpenMP 6.1 or later.Map-type-modifying modifiers applied to a list item with a user-defined mapper are now propagated onto the maps the mapper expands to.
Mapping of expressions with base-pointers through a user-defined mapper (e.g.
map(s.p[0:n])) now conforms to OpenMP’s conditional pointer-attachment, matching the behavior of such maps outside a mapper.The
holdsclause on theassumedirective now lowers side-effect-free conditions tollvm.assume, enabling downstream optimizations. Previously the clause was parsed but its condition was discarded without effect.
SYCL Support#
Improvements#
Additional Information#
A wide variety of additional information is available on the Clang web
page. The web page contains versions of the
API documentation which are up-to-date with the Git version of
the source code. You can access versions of these documents specific to
this release by going into the “clang/docs/” directory in the Clang
tree.
If you have any questions or comments about Clang, please feel free to contact us on the Discourse forums (Clang Frontend category).