mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 03:46:07 +00:00

This pull request would solve https://github.com/llvm/llvm-project/issues/78449 . There is also a discussion about this on stackoverflow: https://stackoverflow.com/questions/77832658/stdtype-identity-to-support-several-variadic-argument-lists . The following program is well formed: ```cpp #include <type_traits> template <typename... T> struct args_tag { using type = std::common_type_t<T...>; }; template <typename... T> void bar(args_tag<T...>, std::type_identity_t<T>..., int, std::type_identity_t<T>...) {} // example int main() { bar(args_tag<int, int>{}, 4, 8, 15, 16, 23); } ``` but Clang rejects it, while GCC and MSVC doesn't. The reason for this is that, in `Sema::DeduceTemplateArguments` we are not prepared for this case. # Substitution/deduction of parameter packs The logic that handles substitution when we have explicit template arguments (`SubstituteExplicitTemplateArguments`) does not work here, since the types of the pack are not pushed to `ParamTypes` before the loop starts that does the deduction. The other "candidate" that may could have handle this case would be the loop that does the deduction for trailing packs, but we are not dealing with trailing packs here. # Solution proposed in this PR The solution proposed in this PR works similar to the trailing pack deduction. The main difference here is the end of the deduction cycle. When a non-trailing template pack argument is found, whose type is not explicitly specified and the next type is not a pack type, the length of the previously deduced pack is retrieved (let that length be `s`). After that the next `s` arguments are processed in the same way as in the case of non trailing packs. # Another possible solution There is another possible approach that would be less efficient. In the loop when we get to an element of `ParamTypes` that is a pack and could be substituted because the type is deduced from a previous argument, then `s` number of arg types would be inserted before the current element of `ParamTypes` type. Then we would "cancel" the processing of the current element, first process the previously inserted elements and the after that re-process the current element. Basically we would do what `SubstituteExplicitTemplateArguments` does but during deduction. # Adjusted test cases In `clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp` there is a test case named `test_pack_not_at_end` that should work, but still does not. This test case is relevant because the note for the error message has changed. This is what the test case looks like currently: ```cpp template<typename ...Types> void pack_not_at_end(tuple<Types...>, Types... values, int); // expected-note {{<int *, double *> vs. <int, int>}} void test_pack_not_at_end(tuple<int*, double*> t2) { pack_not_at_end(t2, 0, 0, 0); // expected-error {{no match}} // FIXME: Should the "original argument type must match deduced parameter // type" rule apply here? pack_not_at_end<int*, double*>(t2, 0, 0, 0); // ok } ``` The previous note said (before my changes): ``` deduced conflicting types for parameter 'Types' (<int *, double *> vs. <>) ```` The current note says (after my changesand also clang 14 would say this if the pack was not trailing): ``` deduced conflicting types for parameter 'Types' (<int *, double *> vs. <int, int>) ``` GCC says: ``` error: no matching function for call to ‘pack_not_at_end(std::tuple<int*, double*>&, int, int, int)’ 70 | pack_not_at_end(t2, 0, 0, 9); // expected-error {{no match}} ```` --------- Co-authored-by: cor3ntin <corentinjabot@gmail.com> Co-authored-by: Erich Keane <ekeane@nvidia.com>
238 lines
5.8 KiB
ReStructuredText
238 lines
5.8 KiB
ReStructuredText
===========================================
|
|
Clang |release| |ReleaseNotesTitle|
|
|
===========================================
|
|
|
|
.. contents::
|
|
:local:
|
|
:depth: 2
|
|
|
|
Written by the `LLVM Team <https://llvm.org/>`_
|
|
|
|
.. only:: PreRelease
|
|
|
|
.. warning::
|
|
These are in-progress notes for the upcoming Clang |version| release.
|
|
Release notes for previous releases can be found on
|
|
`the Releases Page <https://llvm.org/releases/>`_.
|
|
|
|
Introduction
|
|
============
|
|
|
|
This document contains the release notes for the Clang C/C++/Objective-C
|
|
frontend, part of the LLVM Compiler Infrastructure, release |release|. 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 <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ release notes,
|
|
see `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases
|
|
may be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
|
|
|
|
For more information about Clang or LLVM, including information about the
|
|
latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
|
|
`LLVM Web Site <https://llvm.org>`_.
|
|
|
|
Potentially Breaking Changes
|
|
============================
|
|
These changes are ones which we think may surprise users when upgrading to
|
|
Clang |release| because of the opportunity they pose for disruption to existing
|
|
code bases.
|
|
|
|
C/C++ Language Potentially Breaking Changes
|
|
-------------------------------------------
|
|
|
|
C++ Specific Potentially Breaking Changes
|
|
-----------------------------------------
|
|
|
|
ABI Changes in This Version
|
|
---------------------------
|
|
|
|
AST Dumping Potentially Breaking Changes
|
|
----------------------------------------
|
|
|
|
What's New in Clang |release|?
|
|
==============================
|
|
Some of the major new features and improvements to Clang are listed
|
|
here. Generic improvements to Clang as a whole or to its underlying
|
|
infrastructure are described first, followed by language-specific
|
|
sections with improvements to Clang's support for those languages.
|
|
|
|
C++ Language Changes
|
|
--------------------
|
|
|
|
C++20 Feature Support
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
C++23 Feature Support
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
C++2c Feature Support
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- Implemented `P2662R3 Pack Indexing <https://wg21.link/P2662R3>`_.
|
|
|
|
|
|
Resolutions to C++ Defect Reports
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
- Substitute template parameter pack, when it is not explicitly specified
|
|
in the template parameters, but is deduced from a previous argument.
|
|
(`#78449: <https://github.com/llvm/llvm-project/issues/78449>`_).
|
|
|
|
C Language Changes
|
|
------------------
|
|
|
|
C23 Feature Support
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
Non-comprehensive list of changes in this release
|
|
-------------------------------------------------
|
|
|
|
New Compiler Flags
|
|
------------------
|
|
|
|
Deprecated Compiler Flags
|
|
-------------------------
|
|
|
|
Modified Compiler Flags
|
|
-----------------------
|
|
|
|
Removed Compiler Flags
|
|
-------------------------
|
|
|
|
Attribute Changes in Clang
|
|
--------------------------
|
|
|
|
Improvements to Clang's diagnostics
|
|
-----------------------------------
|
|
|
|
Improvements to Clang's time-trace
|
|
----------------------------------
|
|
|
|
Bug Fixes in This Version
|
|
-------------------------
|
|
|
|
Bug Fixes to Compiler Builtins
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Bug Fixes to Attribute Support
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Bug Fixes to C++ Support
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- Fix crash when using lifetimebound attribute in function with trailing return.
|
|
Fixes (`#73619 <https://github.com/llvm/llvm-project/issues/73619>`_)
|
|
- Fix a crash when specializing an out-of-line member function with a default
|
|
parameter where we did an incorrect specialization of the initialization of
|
|
the default parameter.
|
|
Fixes (`#68490 <https://github.com/llvm/llvm-project/issues/68490>`_)
|
|
- Fixed a bug where variables referenced by requires-clauses inside
|
|
nested generic lambdas were not properly injected into the constraint scope.
|
|
(`#73418 <https://github.com/llvm/llvm-project/issues/73418>`_)
|
|
|
|
Bug Fixes to AST Handling
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Miscellaneous Bug Fixes
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Miscellaneous Clang Crashes Fixed
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
OpenACC Specific Changes
|
|
------------------------
|
|
|
|
Target Specific Changes
|
|
-----------------------
|
|
|
|
AMDGPU Support
|
|
^^^^^^^^^^^^^^
|
|
|
|
X86 Support
|
|
^^^^^^^^^^^
|
|
|
|
Arm and AArch64 Support
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Android Support
|
|
^^^^^^^^^^^^^^^
|
|
|
|
Windows Support
|
|
^^^^^^^^^^^^^^^
|
|
|
|
LoongArch Support
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
RISC-V Support
|
|
^^^^^^^^^^^^^^
|
|
|
|
- ``__attribute__((rvv_vector_bits(N)))`` is now supported for RVV vbool*_t types.
|
|
|
|
CUDA/HIP Language Changes
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
CUDA Support
|
|
^^^^^^^^^^^^
|
|
|
|
AIX Support
|
|
^^^^^^^^^^^
|
|
|
|
WebAssembly Support
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
AVR Support
|
|
^^^^^^^^^^^
|
|
|
|
DWARF Support in Clang
|
|
----------------------
|
|
|
|
Floating Point Support in Clang
|
|
-------------------------------
|
|
|
|
AST Matchers
|
|
------------
|
|
|
|
clang-format
|
|
------------
|
|
|
|
libclang
|
|
--------
|
|
|
|
Static Analyzer
|
|
---------------
|
|
|
|
New features
|
|
^^^^^^^^^^^^
|
|
|
|
Crash and bug fixes
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
Improvements
|
|
^^^^^^^^^^^^
|
|
|
|
- Support importing C++20 modules in clang-repl.
|
|
|
|
Moved checkers
|
|
^^^^^^^^^^^^^^
|
|
|
|
.. _release-notes-sanitizers:
|
|
|
|
Sanitizers
|
|
----------
|
|
|
|
Python Binding Changes
|
|
----------------------
|
|
|
|
Additional Information
|
|
======================
|
|
|
|
A wide variety of additional information is available on the `Clang web
|
|
page <https://clang.llvm.org/>`_. 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)
|
|
<https://discourse.llvm.org/c/clang/6>`_.
|