mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 01:18:53 +00:00
282cae0b9a
Fixes #61441. Currently, Clang stores `nullptr` in the parameter lists inside `FunctionProtoTypeLoc` if `__fp16` is used without pointer qualifiers. Any code path that calls `Declarator::setInvalidType()` before `GetFullTypeForDeclarator` will lead to the same problem downstream. The relevant code is: ```cpp if (D.isInvalidType()) return Context.getTrivialTypeSourceInfo(T); return GetTypeSourceInfoForDeclarator(state, T, TInfo); ``` `GetTypeSourceInfoForDeclarator` sets the parameter `Decl`, but we can't call it when `isInvalidType() == true` as this causes other assertion failures that seem harder to fix. Reviewed By: kadircet Differential Revision: https://reviews.llvm.org/D146426
13 lines
437 B
C++
13 lines
437 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify -cl-std=clc++ -fblocks %s
|
|
// Checks Clang does not crash. We run in OpenCL mode to trigger block pointer
|
|
// crash. The __fp16 crash happens in standard mode too.
|
|
|
|
template <bool>
|
|
int foo() {
|
|
auto x = [&](__fp16) { return 0; }; // expected-error {{not allowed}}
|
|
auto y = [&](void(^)(int)) { return 0; }; // expected-error {{not allowed}}
|
|
return 0;
|
|
}
|
|
|
|
int bar() { return foo<true>(); }
|