Matheus Izvekov 7284e0f3a4
[clang] mangle placeholder for deduced type as a template-prefix (#106335)
As agreed on https://github.com/itanium-cxx-abi/cxx-abi/issues/109 these
placeholders should be mangled as a `template-prefix` production.

```
    <template-prefix> ::= <template unqualified-name>           # global template
                      ::= <prefix> <template unqualified-name>  # nested template
                      ::= <template-param>                      # template template parameter
                      ::= <substitution>
```

Previous to this patch, the template template parameter case was not
handled, and template template parameters were incorrectly being handled
as unqualified-names.

Before #95202, DeducedTemplateType was not canonicalized correctly, so
that template template parameter declarations were retained
uncanonicalized.

After #95202, they are correctly canonicalized, but this now leads to
these TTPs being anonymous entities, where the mangling implementation
correctly doesn't expect an anonymous declaration of this kind, leading
to a crash.

Fixes #106182.
2024-08-29 18:53:03 -03:00

13 lines
321 B
C++

// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
template <template <class> class S>
void create_unique()
requires (S{0}, true) {}
template <class Fn> struct A {
constexpr A(Fn) {};
};
template void create_unique<A>();
// CHECK: @_Z13create_uniqueI1AEvvQcmtlT_Li0EELb1E(