This patch solves an error such as:
incompatible operand types ('vbool4_t' (aka '__rvv_bool4_t') and '__rvv_bool4_t')
when one of the value is a TypedefType of the other value in ?:.
Paths
| Differential D103603
[Sema][RISCV][SVE] Allow ?: to select Typedef BuiltinType in C ClosedPublic Authored by arcbbb on Jun 3 2021, 3:01 AM.
Details Summary This patch solves an error such as: incompatible operand types ('vbool4_t' (aka '__rvv_bool4_t') and '__rvv_bool4_t') when one of the value is a TypedefType of the other value in ?:.
Diff Detail
Event TimelineHerald added subscribers: vkmr, frasercrmck, evandro and 24 others. · View Herald TranscriptJun 3 2021, 3:01 AM Comment Actions Testcase for AArch64/SVE: #include <arm_sve.h> svint8_t a(); __SVInt8_t b(); svint8_t foo(int cond){ return cond ? a(): b(); } Comment Actions The testcase I provided in last comment could be compile successfully with aarch64-gcc, but failed on clang. Comment Actions Thanks for the fix. I agree this is the right behaviour FWIW. I held off approving it in case there's another idiom that's preferred when comparing canonical types. Comment Actions
Could that AArch64 test also be part of this patch? This revision now requires changes to proceed.Jun 3 2021, 4:21 AM arcbbb marked an inline comment as done. arcbbb retitled this revision from [Sema][RISCV] Allow ?: to select Typedef BuiltinType in C to [Sema][RISCV][SVE] Allow ?: to select Typedef BuiltinType in C. Comment ActionsAdd a case in AArch64 test and address review comments. Closed by commit rGfcf8827a98be: [Sema][RISCV][SVE] Allow ?: to select Typedef BuiltinType in C (authored by arcbbb). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 349777 clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/riscv-types.c
clang/test/Sema/sizeless-1.c
|
This is Context.hasSameType, and the braces are unnecessary.