mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 12:39:19 +00:00
[Concepts] Add null check for TemplateTypeParmType::getDecl() in GetContainedInventedTypeParmVisitor
GetContainedInventedTypeParmVisitor would not account for the case where TemplateTypeParmType::getDecl() is nullptr, causing bug #45102. Add the nullptr check.
This commit is contained in:
parent
fb8149cac8
commit
865456d589
@ -2162,7 +2162,7 @@ namespace {
|
|||||||
// The deduced type itself.
|
// The deduced type itself.
|
||||||
TemplateTypeParmDecl *VisitTemplateTypeParmType(
|
TemplateTypeParmDecl *VisitTemplateTypeParmType(
|
||||||
const TemplateTypeParmType *T) {
|
const TemplateTypeParmType *T) {
|
||||||
if (!T->getDecl()->isImplicit())
|
if (!T->getDecl() || !T->getDecl()->isImplicit())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return T->getDecl();
|
return T->getDecl();
|
||||||
}
|
}
|
||||||
|
@ -31,3 +31,15 @@ struct G {
|
|||||||
|
|
||||||
using gf1 = decltype(G<int, char>::foo1('a', 1, 2, 3, 4)); // expected-error{{no matching function}}
|
using gf1 = decltype(G<int, char>::foo1('a', 1, 2, 3, 4)); // expected-error{{no matching function}}
|
||||||
using gf2 = decltype(G<int, char>::foo2('a', 1, 2)); // expected-error{{no matching function}}
|
using gf2 = decltype(G<int, char>::foo2('a', 1, 2)); // expected-error{{no matching function}}
|
||||||
|
|
||||||
|
|
||||||
|
// Regression (bug #45102): check that instantiation works where there is no
|
||||||
|
// TemplateTypeParmDecl
|
||||||
|
template <typename T> using id = T;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
constexpr void g() {
|
||||||
|
id<void (T)> f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static_assert((g<int>(), true));
|
Loading…
x
Reference in New Issue
Block a user