[all-commits] [llvm/llvm-project] 7b3389: [Clang][Sema] fix outline member function template...

Qizhi Hu via All-commits all-commits at lists.llvm.org
Thu Jan 25 22:46:54 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b3389980ddbd84f72ccc4776889c67519cc2c14
      https://github.com/llvm/llvm-project/commit/7b3389980ddbd84f72ccc4776889c67519cc2c14
  Author: Qizhi Hu <836744285 at qq.com>
  Date:   2024-01-26 (Fri, 26 Jan 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 (#78400)

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 class.
Fix it by add template args of context when it's out-of-line. This will
make `MultiLevelTemplateArgumentList::getNumLevels` matching the depth
of template parameter. Testcase with some `static_assert` demonstrates
the template parameter has been instanced correctly.

Co-authored-by: huqizhi <836744285 at qq.com>




More information about the All-commits mailing list