[all-commits] [llvm/llvm-project] 229cb6: [clang] NFCI: use TemplateArgumentLoc for NTTP Def...
Matheus Izvekov via All-commits
all-commits at lists.llvm.org
Thu May 23 17:30:59 PDT 2024
Branch: refs/heads/users/mizvekov/clang-cwg2398-ttp-matches-class-template
Home: https://github.com/llvm/llvm-project
Commit: 229cb63b95bb3b0db8d73947a40dede945b8b378
https://github.com/llvm/llvm-project/commit/229cb63b95bb3b0db8d73947a40dede945b8b378
Author: Matheus Izvekov <mizvekov at gmail.com>
Date: 2024-05-21 (Tue, 21 May 2024)
Changed paths:
M clang-tools-extra/clangd/Hover.cpp
M clang/include/clang/AST/ASTNodeTraverser.h
M clang/include/clang/AST/DeclTemplate.h
M clang/include/clang/AST/RecursiveASTVisitor.h
M clang/lib/AST/ASTContext.cpp
M clang/lib/AST/ASTDiagnostic.cpp
M clang/lib/AST/ASTImporter.cpp
M clang/lib/AST/DeclPrinter.cpp
M clang/lib/AST/DeclTemplate.cpp
M clang/lib/AST/JSONNodeDumper.cpp
M clang/lib/AST/ODRDiagsEmitter.cpp
M clang/lib/AST/ODRHash.cpp
M clang/lib/AST/TypePrinter.cpp
M clang/lib/ExtractAPI/DeclarationFragments.cpp
M clang/lib/Index/IndexDecl.cpp
M clang/lib/Sema/HLSLExternalSemaSource.cpp
M clang/lib/Sema/SemaTemplate.cpp
M clang/lib/Sema/SemaTemplateDeduction.cpp
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
M clang/lib/Serialization/ASTReaderDecl.cpp
M clang/lib/Serialization/ASTWriterDecl.cpp
M clang/test/AST/ast-dump-decl.cpp
M clang/test/SemaTemplate/deduction-guide.cpp
M clang/tools/libclang/CIndex.cpp
M clang/unittests/AST/ASTImporterTest.cpp
Log Message:
-----------
[clang] NFCI: use TemplateArgumentLoc for NTTP DefaultArgument
This is an enabler for a future patch.
Commit: 73d456c632a1419c39316d38dcdc358b8e4f9636
https://github.com/llvm/llvm-project/commit/73d456c632a1419c39316d38dcdc358b8e4f9636
Author: Matheus Izvekov <mizvekov at gmail.com>
Date: 2024-05-21 (Tue, 21 May 2024)
Changed paths:
M clang/lib/Sema/SemaTemplate.cpp
M clang/lib/Sema/SemaTemplateDeduction.cpp
M clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp
M clang/test/SemaTemplate/cwg2398.cpp
Log Message:
-----------
[clang] Implement CWG2398 provisional TTP matching to class templates
This solves some ambuguity introduced in P0522 regarding how
template template parameters are partially ordered, and should reduce
the negative impact of enabling `-frelaxed-template-template-args`
by default.
When performing template argument deduction, we extend the provisional
wording introduced in https://github.com/llvm/llvm-project/pull/89807
so it also covers deduction of class templates.
Given the following example:
```C++
template <class T1, class T2 = float> struct A;
template <class T3> struct B;
template <template <class T4> class TT1, class T5> struct B<TT1<T5>>; // #1
template <class T6, class T7> struct B<A<T6, T7>>; // #2
template struct B<A<int>>;
```
Prior to P0522, `#2` was picked. Afterwards, this became ambiguous.
This patch restores the pre-P0522 behavior, `#2` is picked again.
This has the beneficial side effect of making the following code valid:
```C++
template<class T, class U> struct A {};
A<int, float> v;
template<template<class> class TT> void f(TT<int>);
// OK: TT picks 'float' as the default argument for the second parameter.
void g() { f(v); }
```
---
Since this changes provisional implementation of CWG2398 which has
not been released yet, and already contains a changelog entry,
we don't provide a changelog entry here.
Compare: https://github.com/llvm/llvm-project/compare/229cb63b95bb%5E...73d456c632a1
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list