[clang] [clang] fix crash related to missing source locations for converted template arguments (PR #187352)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 20 01:02:11 PDT 2026


mstorsjo wrote:

This change broke building for 32 bit architectures (noted with both Clang/libc++ and GCC/libstdc++, for i686 and arm):
https://github.com/mstorsjo/llvm-mingw/actions/runs/23325141806/job/67857046400

```
/home/runner/work/llvm-mingw/llvm-mingw/llvm-project/clang/lib/AST/TemplateBase.cpp:753:13: error: no viable overloaded '='
  753 |     Pointer = reinterpret_cast<void *>((TrivialLoc.getRawEncoding() + 1u)
      |     ~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  754 |                                        << LowBitsRequired);
      |                                        ~~~~~~~~~~~~~~~~~~~
/home/runner/work/llvm-mingw/llvm-mingw/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:185:23: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'std::nullptr_t' for 1st argument
  185 |   const PointerUnion &operator=(std::nullptr_t) {
      |                       ^         ~~~~~~~~~~~~~~
/home/runner/work/llvm-mingw/llvm-mingw/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:54:9: note: candidate function (the implicit copy assignment operator) not viable: cannot convert argument of incomplete type 'void *' to 'const PointerUnionMembers<llvm::PointerUnion<clang::TemplateArgumentLocInfo::TemplateTemplateArgLocInfo *, clang::Expr *, clang::TypeSourceInfo *, clang::SourceLocation *>, llvm::PointerIntPair<void *, 2, int, llvm::pointer_union_detail::PointerUnionUIntTraits<clang::TemplateArgumentLocInfo::TemplateTemplateArgLocInfo *, clang::Expr *, clang::TypeSourceInfo *, clang::SourceLocation *>>, 4>' for 1st argument
   54 |   class PointerUnionMembers<Derived, ValTy, I> {
      |         ^~~~~~~~~~~~~~~~~~~
/home/runner/work/llvm-mingw/llvm-mingw/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:54:9: note: candidate function (the implicit move assignment operator) not viable: cannot convert argument of incomplete type 'void *' to 'PointerUnionMembers<llvm::PointerUnion<clang::TemplateArgumentLocInfo::TemplateTemplateArgLocInfo *, clang::Expr *, clang::TypeSourceInfo *, clang::SourceLocation *>, llvm::PointerIntPair<void *, 2, int, llvm::pointer_union_detail::PointerUnionUIntTraits<clang::TemplateArgumentLocInfo::TemplateTemplateArgLocInfo *, clang::Expr *, clang::TypeSourceInfo *, clang::SourceLocation *>>, 4>' for 1st argument
   54 |   class PointerUnionMembers<Derived, ValTy, I> {
      |         ^~~~~~~~~~~~~~~~~~~
/home/runner/work/llvm-mingw/llvm-mingw/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:77:14: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'clang::SourceLocation *' for 1st argument
   77 |     Derived &operator=(Type V) {
      |              ^         ~~~~~~
[...]
```

https://github.com/llvm/llvm-project/pull/187352


More information about the cfe-commits mailing list