[clang] use canonical arguments for checking function template constraints (#186889) This is a partial revert of #161671, restoring the original behaviour where the canonical template arguments are used for function template constraint checking in diagnostics. This reverts the fix from #183010, which attempted to fix #182344 but it causes regressions. These regressions now have test cases included. The attempt at #183010 is flawed because in the general case we can't check satisfaction for constraints which have unsubstituted template arguments, even if they don't affect the canonical type (ie they are purely syntactical), because these types can still turn out to be invalid after substitution. This is a problem when directly evaluating a concept specialization, but it's not a problem with other template specializations because the as-written types are preserved, and will be later substituted, and any failures here will cause the program to be ill-formed anyway. The only downside of this revert is the loss of sugar in some diagnostics. This could be improved in the future by adding a new flag which would allow ignoring this instantiation dependence in such cases where a substitution failure will be handled later anyway. This is not done in this patch because we want the safest thing possible, to help backporting this patch to Clang 22. This preserves the tests from #183010 and also adds the tests from #185608. Since this fixes a regression since Clang 21 and will be backported to Clang 22, there are no release notes.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.