diff options
author | Krystian Stasiowski <sdkrystian@gmail.com> | 2024-10-30 09:24:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-30 11:24:10 -0400 |
commit | 7d1e283bd3b4440aea9ac375ca51e2ee6b0e86f5 (patch) | |
tree | 4814416cd3ae189e9c0a852d1527d6b07bc6f388 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | e989e31a47375a7d556269eead538dc65edcef2b (diff) | |
download | llvm-7d1e283bd3b4440aea9ac375ca51e2ee6b0e86f5.zip llvm-7d1e283bd3b4440aea9ac375ca51e2ee6b0e86f5.tar.gz llvm-7d1e283bd3b4440aea9ac375ca51e2ee6b0e86f5.tar.bz2 |
[Clang][Sema] Ignore previous partial specializations of member templates explicitly specialized for an implicitly instantiated class template specialization (#113464)
Consider the following:
```
template<typename T>
struct A {
template<typename U>
struct B {
static constexpr int x = 0; // #1
};
template<typename U>
struct B<U*> {
static constexpr int x = 1; // #2
};
};
template<>
template<typename U>
struct A<long>::B {
static constexpr int x = 2; // #3
};
static_assert(A<short>::B<int>::y == 0); // uses #1
static_assert(A<short>::B<int*>::y == 1); // uses #2
static_assert(A<long>::B<int>::y == 2); // uses #3
static_assert(A<long>::B<int*>::y == 2); // uses #3
```
According to [temp.spec.partial.member] p2:
> If the primary member template is explicitly specialized for a given
(implicit) specialization of the enclosing class template, the partial
specializations of the member template are ignored for this
specialization of the enclosing class template.
If a partial specialization of the member template is explicitly
specialized for a given (implicit) specialization of the enclosing class
template, the primary member template and its other partial
specializations are still considered for this specialization of the
enclosing class template.
The example above fails to compile because we currently don't implement
[temp.spec.partial.member] p2. This patch implements the wording, fixing #51051.
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
0 files changed, 0 insertions, 0 deletions