[Clang][Sema] Fix __builtin_infer_alloc_token() return type (#168773)
Using the builtin failed on 32-bit architectures: ``` clang/lib/AST/ExprConstant.cpp:14299: [..]: Assertion `I.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) && "Invalid evaluation result."' failed. ``` The return type is meant to be size_t. Fix it.
This commit is contained in:
parent
2b16ae0d42
commit
609c88a1fd
@ -1512,7 +1512,7 @@ static bool checkBuiltinInferAllocToken(Sema &S, CallExpr *TheCall) {
|
||||
return S.Diag(Arg->getBeginLoc(), diag::err_param_with_void_type);
|
||||
}
|
||||
|
||||
TheCall->setType(S.Context.UnsignedLongLongTy);
|
||||
TheCall->setType(S.Context.getSizeType());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter
|
||||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s -falloc-token-mode=typehash -DMODE_TYPEHASH
|
||||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify %s -falloc-token-max=2 -DTOKEN_MAX=2
|
||||
// RUN: %clang_cc1 -triple arm-linux-androideabi -std=c++23 -fsyntax-only -verify %s -falloc-token-max=2 -DTOKEN_MAX=2
|
||||
// RUN: %clang_cc1 -triple arm-linux-androideabi -std=c++23 -fsyntax-only -verify %s -falloc-token-max=2 -DTOKEN_MAX=2 -fexperimental-new-constant-interpreter
|
||||
|
||||
#if !__has_builtin(__builtin_infer_alloc_token)
|
||||
#error "missing __builtin_infer_alloc_token"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user