[all-commits] [llvm/llvm-project] 752c17: [Clang][Sema] fix outline member function template...
Qizhi Hu via All-commits
all-commits at lists.llvm.org
Sat Feb 3 05:49:22 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 752c172bc7d628fe5ce4a78f3620893b8d7bcfba
https://github.com/llvm/llvm-project/commit/752c172bc7d628fe5ce4a78f3620893b8d7bcfba
Author: Qizhi Hu <836744285 at qq.com>
Date: 2024-02-03 (Sat, 03 Feb 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Sema/SemaTemplateInstantiate.cpp
A clang/test/SemaTemplate/default-parm-init.cpp
Log Message:
-----------
[Clang][Sema] fix outline member function template with default align crash (#80288)
Try to fix [issue](https://github.com/llvm/llvm-project/issues/68490 )
and some extented problem. Root cause of current issue is that error
handling in instantiation of function parameter with default
initialization on sizeof or align expression. When instance an
out-of-line template member function, depth of `TemplateTypeParmDecl` in
default initialization doesn't change while depth of other template
parameter does and this will lead to some template parameter
uninstanced. Also, sometime it will leader to wrong instantiation when
it uses the template parameter of the template class.
Fix it by add template args of context. This will make
MultiLevelTemplateArgumentList::getNumLevels matching the depth of
template parameter. Testcase with some static_assert demonstrates the
template parameter has been instanced correctly.
But, the default initialization of lambda expression compiles failed
when only checking if the member function is out-of-line. We should
check the `PrimaryFunctionTemplateDecl` of the funtion if it's
out-of-line.
Co-authored-by: huqizhi <836744285 at qq.com>
More information about the All-commits
mailing list