mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-25 04:51:38 +00:00
Fix a crash on an invalid templated UDL declaration
We were missing a null pointer check that a template parameter existed at all.
This commit is contained in:
parent
4a9bcb605b
commit
f2ea852550
@ -15908,7 +15908,7 @@ checkLiteralOperatorTemplateParameterList(Sema &SemaRef,
|
||||
//
|
||||
// As a DR resolution, we also allow placeholders for deduced class
|
||||
// template specializations.
|
||||
if (SemaRef.getLangOpts().CPlusPlus20 &&
|
||||
if (SemaRef.getLangOpts().CPlusPlus20 && PmDecl &&
|
||||
!PmDecl->isTemplateParameterPack() &&
|
||||
(PmDecl->getType()->isRecordType() ||
|
||||
PmDecl->getType()->getAs<DeducedTemplateSpecializationType>()))
|
||||
|
@ -51,3 +51,9 @@ void test_if_2() { "foo"if; } // expected-error {{no matching literal operator f
|
||||
template<typename T> void dependent_member_template() {
|
||||
T().template operator""_foo<int>(); // expected-error {{'operator""_foo' following the 'template' keyword cannot refer to a dependent template}}
|
||||
}
|
||||
|
||||
namespace PR51142 {
|
||||
// This code previously crashed due to a null template parameter declaration.
|
||||
template<typename T> // expected-error {{template parameter list for literal operator must be either 'char...' or 'typename T, T...'}}
|
||||
constexpr auto operator ""_l();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user