On Sat, Jun 10, 2023 at 12:37:40PM +0200, Jakub Jelinek via Gcc-patches wrote: > I think changing __builtin_classify_type behavior after 35 years > would be dangerous, shall we introduce a new similar builtin which > would just never promote the argument/perform array/function/enum > conversions on it, so that > __builtin_type_classify (true) == boolean_type_class > enum E { E1, E2 } e; > __builtin_type_classify (e) == enumeral_type_class > int a[2]; > __builtin_type_classify (a) == array_type_class > etc.? > Seems clang changed __builtin_type_classify at some point > so that it e.g. returns enumeral_type_class for enum arguments > and array_type_class for arrays, but doesn't return boolean_type_class > for _Bool argument.
Another option would be just extend the current __builtin_classify_type to be more sizeof like, that the argument could be either expression with current behavior, or type, and so one could use __builtin_classify_type (int) or __builtin_classify_type (0) or __builtin_classify_type (typeof (expr)) and the last way would ensure no argument promotion happens. Jakub