llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)

<details>
<summary>Changes</summary>

Fixes #<!-- -->111300

---
Full diff: https://github.com/llvm/llvm-project/pull/183972.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaExpr.cpp (+2-2) 
- (modified) clang/test/Sema/sugar-common-types.c (+5-1) 


``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 2675d1680fc56..53d215f5c5e3e 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8892,9 +8892,9 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, 
ExprResult &LHS,
   // C99 6.5.15p5: "If both operands have void type, the result has void type."
   // The following || allows only one side to be void (a GCC-ism).
   if (LHSTy->isVoidType() || RHSTy->isVoidType()) {
-    QualType ResTy;
     if (LHSTy->isVoidType() && RHSTy->isVoidType()) {
-      ResTy = Context.getCommonSugaredType(LHSTy, RHSTy);
+      // UsualArithmeticConversions already handled the case where both sides
+      // are the same type.
     } else if (RHSTy->isVoidType()) {
       ResTy = RHSTy;
       Diag(RHS.get()->getBeginLoc(), diag::ext_typecheck_cond_one_void)
diff --git a/clang/test/Sema/sugar-common-types.c 
b/clang/test/Sema/sugar-common-types.c
index 54a6e3afed421..4fc345e9a2946 100644
--- a/clang/test/Sema/sugar-common-types.c
+++ b/clang/test/Sema/sugar-common-types.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c99 -triple aarch64 
-target-feature +bf16 -target-feature +sve
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c99 -triple aarch64 
-target-feature +bf16 -target-feature +sve -Wno-void-ptr-dereference
 
 typedef struct N {} N;
 
@@ -42,3 +42,7 @@ void f8() {
   Y6 y6;
   N t8 = 0 ? x6 : y6; // expected-error {{incompatible type 'B6'}}
 }
+
+const volatile X2 *x7;
+volatile Y2 *y7;
+N t9 = 0 ? *x7 : *y7; // expected-error {{incompatible type 'B2'}}

``````````

</details>


https://github.com/llvm/llvm-project/pull/183972
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to