[clang] diagnose block pointer types as invalid for constant template parameters (#190464)
Fixes a crash by making it ill-formed to have a constant template parameter with a block pointer type. Fixes #189247
This commit is contained in:
parent
7fd02b32f9
commit
17ed1e6c4b
@ -412,6 +412,7 @@ Bug Fixes to Attribute Support
|
||||
|
||||
Bug Fixes to C++ Support
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Clang now rejects constant template parameters with block pointer types, since these are not implemented anyway and would lead to crashes. (#GH189247)
|
||||
- Fixed a crash on error recovery when dealing with invalid templates. (#GH183075)
|
||||
- Fixed a crash when instantiating ``requires`` expressions involving substitution failures in C++ concepts. (#GH176402)
|
||||
- Fixed an incorrect template argument deduction when matching packs of template
|
||||
|
||||
@ -1459,6 +1459,11 @@ QualType Sema::CheckNonTypeTemplateParameterType(QualType T,
|
||||
return QualType();
|
||||
}
|
||||
|
||||
if (T->isBlockPointerType()) {
|
||||
Diag(Loc, diag::err_template_nontype_parm_bad_type) << T;
|
||||
return QualType();
|
||||
}
|
||||
|
||||
// C++ [temp.param]p4:
|
||||
//
|
||||
// A non-type template-parameter shall have one of the following
|
||||
|
||||
@ -163,3 +163,7 @@ void static_data_member() {
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
namespace gh189247 {
|
||||
template<void (^)()> struct A; // expected-error {{a non-type template parameter cannot have type 'void (^)()'}}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user