llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

They can appear here in -fms-compatibility mode.

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+4) 
- (modified) clang/test/AST/ByteCode/ms.cpp (+4-1) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index c9f44807c9080..f2ff5083fe6ef 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -2328,6 +2328,10 @@ static bool interp__builtin_memcmp(InterpState &S, 
CodePtr OpPC,
     pushInteger(S, 0, Call->getType());
     return true;
   }
+
+  if (PtrA.isFunctionPointer() || PtrB.isFunctionPointer())
+    return false;
+
   bool IsWide =
       (ID == Builtin::BIwmemcmp || ID == Builtin::BI__builtin_wmemcmp);
 
diff --git a/clang/test/AST/ByteCode/ms.cpp b/clang/test/AST/ByteCode/ms.cpp
index b5c42e3ad78e2..ddce419a178ac 100644
--- a/clang/test/AST/ByteCode/ms.cpp
+++ b/clang/test/AST/ByteCode/ms.cpp
@@ -24,4 +24,7 @@ auto foo() {
 label:
 } // both-warning {{C++23 extension}}
 
-
+int somefunc();
+void fnptrinmemcmp() { static_assert(__builtin_memcmp(&somefunc, &somefunc, 1) 
== 0, ""); } // both-warning 2{{implicit conversion between pointer-to-function 
and pointer-to-object is a Microsoft extension}} \
+                                                                               
             // both-error {{not an integral constant expression}} \
+                                                                               
             // both-note {{cast that performs the conversions of a 
reinterpret_cast is not allowed in a constant expression}}

``````````

</details>


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

Reply via email to